/* The function maxToFront should take an array as input and * move the maximum element to the front, keeping all other * elements in their initial order. */ #include #include void maxToFront(int a[], int n) { /* BEGIN ANSWER -- do not delete this line */ // ADD YOUR CODE HERE /* END ANSWER -- do not delete this line */ } /* PLEASE DO NOT EDIT THE 'main' FUNCTION. IT IS THERE * FOR TESTING PURPOSES. */ int main (void) { int i; int b[10]={6,2,4,44,5,-10,-6, 5, 8,2}; int c[15]={2,3,44,-6,4,8,-2,44,9,6,1,3,4,-11,0}; maxToFront(b, 10); printf("After maxToFront, b is %d", b[0]); for(i=1; i<10; i++) printf(", %d", b[i]); printf(".\n"); maxToFront(c, 15); printf("After maxToFront, c is %d", c[0]); for(i=1; i<15; i++) printf(", %d", c[i]); printf(".\n"); return EXIT_SUCCESS; }