Question: Write a C program to sort 10 integers in ascending or descending order with respect to the users choice (a or d). For sorting these

Write a C program to sort 10 integers in ascending or descending order with respect to the users choice (a or d). For sorting these integers, define and use the function having the prototype below:

void bubbleSort(int *array, char order);

In main function, array values must be filled with random integers in the interval [-100, 100] and printed on the screen. Additionally, getting the input from user and printing the final values of the array must be performed in the main function.

EXAMPLE OUTPUT :

10 random numbers generated = 21 -97 -61 54 -81 23 77 -4 46 12

Enter the sorting order (a or d): d

-----------------------------------

Values in DESCENDING order = 77 54 46 23 21 12 -4 -61 -81 -97

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!