各位高手帮忙~~
#include "stdio.h"void sort (int a[], int n)
{
int i, j, temp;
for ( i = 0; i < n; ++i )
for ( j = 0; j < i; ++j )
if ( a[i] > a[j]) {
temp = a [i];
a [i] = a [j];
a [j] = temp;
}
}
main()
{
int i;
int array [16] = { 34, -5, 6, 0, 12, 100, 56, 22,
44, -3, -9, 12, 17, 22, 6, 11 };
void sort (int a[], int n);
printf ("the array befor sort:\n");
for ( i = 0; i < 16; ++i )
printf ("%i", array[i] );
sort (array, 16);
printf ("\nthe array after sort:\n")
for (i = 0; i < 16; ++i )
printf ("%i", array[i] );
printf ("\n");
return 0;
}