Question: Write a C language program that inputs ASCII characters and stores them in a character array until the enter key is hit (0x0D) or until

Write a C language program that inputs ASCII characters and stores them in a character array until the enter key is hit (0x0D) or until 32 characters have been entered. Next, end the character array with the null character (0x00). Display this character (string) array on a new line in the hyperterminal window. Finally, have the program sort these ASCII characters from lowest to highest and display on a new line this sorted character array. The program should then print a new line and start over waiting for user input.

For example, if the input is:

45F37X

The output display for this program would be:

45F37X

3457FX

A simple sorting algorithm can be used to sort the ASCII character array:

for(i = 0; i++; i < N-1){

for(j = 0; j++; j < N-1){

if( ARRAY[j] > ARRAY[j+1] ){

temp =ARRAY[j];

ARRAY[j]=ARRAY[j+1]

ARRAY[j+1]=ARRAY[j]

}

}

}

where N is the number of elements in the array ARRAY[i] that are to be sorted.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!