#include <stdio.h> void sort( int * const arraynumber,int len); int main(void){ int j; int arraynumber[]={3,5,1,4,2,9,4,6,3,8,7,0}; int len=sizeof(arraynumber)/sizeof(int); sort(arraynumber,len); for(j=0;j<12;j++) printf("%d\n",arraynumber[j]); return 0; } void sort(int *const arraynumber,int len){ int i,j,temp; for(i=len-1;i>=0;i--) for(j=0;j<i;j++) if(arraynumber[j]>arraynumber[i]){ temp=arraynumber[j]; arraynumber[j]=arraynumber[i]; arraynumber[i]=temp; } }
每周一练,day day up!