Question: Description: Complete the following C programming exercises. Each program must include a comment header and line comments as described in class. 3 4 7 8

 Description: Complete the following C programming exercises. Each program must includea comment header and line comments as described in class. 3 4

Description: Complete the following C programming exercises. Each program must include a comment header and line comments as described in class. 3 4 7 8 4. Modify the sort() function from Program 7.12 (listed below) to take a third argument indicating whether the array to be sorted in ascending or descending order. Then modify the sort() algorithm to correctly sort the array into the indicated order. 1 // Program to sort an array of integers into ascending order 2 #include void sort (int a[], int n) { 5 int i, j, temp; 6 for (i = 0; i a[j] ) { 9 temp = a[i]; 10 a[i] = a[j]; 11 a[j] = temp; 12 } 13 } 14 int main (void) 15 { 16 int i; 17 int array[16] = { 34, -5, 6, , 12, 100, 56, 22, 18 44, -3, -9, 12, 17, 22, 6, 11 }; 19 void sort (int a[], int n); 20 printf ("The array before the sort: "); 21 for (i = 0; i

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!