Asked Mar 24, 2020

c programming



1 dimentional  array strings


type any word: handsome
New word: smoenahd

type any word: beautiful
New word: ubeiflatu


Expert Answer

Step 1: Note

In the question, the detail about how to get the new output word is missing. The below program is provided to randomly shuffle the characters in the given input string.

Step 2: Program

A C program that randomly shuffle the characters of the given string is as follows,

File name: “main.c”

#include <stdio.h>

//Define the method to print he character in the array

void viewDeck(const char deck[], int size){

    int i;

    for(i = 0;i<size;i++){





//Define the method to randomly shuffle the characters

void shuffle(char deck[], int size){

    int n1, n2, i;


    for(i = 0;i<size;i++){

        n1 = rand() % size;

        n2 = rand() % size;

        char ch = deck[n1];

        deck[n1] = deck[n2];

        deck[n2] = ch;



//Define the main() method

int main() {

    unsigned char data2[]=" ";

    printf("type any word: ");


    shuffle(data2, 10);

    printf("\nNew Word: ");

    viewDeck(data2, 10);

    return 0;


Step 3: Screenshot of program

Screenshot #1:

Computer Science homework question answer, step 3, image 1

Screenshot #2:

Computer Science homework question answer, step 3, image 2


Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A

Q: A function can return a pointer to a local variable in the function? Why?

A: Pointer: - It stores the address of another variable. It is declared by putting a “*” before the var...


Q: Consider the following c++ enumerated data type.A. Declare a variable.B. Write a for loop to properl...

A: //include the required header files #include &lt;iostream&gt;   //use the std namespace using namesp...


Q: In Python 3, construct a for loop that calculates the sum of all odd or all even numbers starting wi...

A: Program Approach – Prompt the user to enter the number ranging between 1 and 50. If the user provid...


Q: Describe the different types of Semantics, when and how are they applied, what are the advantages or...

A: Semantics is one of linguistics ' major branches, concerned with the understanding and meaning of wo...


Q: please reply fast write a Python program that asks the user to enter a non-negative number (float). ...

A: Following is the python program that takes input from the user a non-negative number and prints the ...


Q: Write a Java program that will ask the user for a starting number, ending number, and a decrement nu...

A: Java program to display the number from in the decremental order the user given starting number to t...


Q: The coding language is python   The code in there may or not be correct I was playing around with it...

A: PROGRAM: # The user in prompted for input and stored in userInput   userInput = str(input("Enter the...


Q: Database normalization is a very important process in designing and organizing tables (relations) an...

A: Database Normalization is a comprehensive means of ensuring that a database configuration is appropr...


Q: //1. Declare an array arr1 and initialize it to 1, 2, 3, 4, 5, 6, 7, 8, and 9//2. Declare another ar...

A: //definition of "Test" class public class Test {     //definition of main method     public static v...