Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - There is an integer array containing 10 elements, and its elements are stored in reverse order.
There is an integer array containing 10 elements, and its elements are stored in reverse order.

Sort backwards. The sorting methods include insertion sort, bubble sort, quick sort, heap sort, etc. You can choose one yourself and sort from largest to smallest.

Take insertion as an example:

static int *

insertsort (int ia[], int size)

{

int i, j;

for (i=1; i

{

int t = ia[i] ;

for (j=i; (j > 0) && t > ia[j-1] ; j--)

ia[j] = ia[j-1 ];

ia[j] = t;

}

return ia;

}