老是忘记改怎么写...
1 #include <stdio.h> 2 #include <stdlib.h> 3 int cmp( const void *a , const void *b ) 4 { 5 return *( int *)a - *( int *)b; 6 } 7 int main() 8 { 9 int n,i,a[ 100]; 10 scanf( " %d ",&n); 11 for (i= 0;i<n;i++) 12 scanf( " %d ",&a[i]); 13 qsort(a,n, sizeof(a[ 0]),cmp); 14 for (i= 0;i<n;i++) 15 printf( " %d ",a[i]); 16