#includeint main(int argc,char *argv[]){ void sortarray(int a[],int s,int e); int a[] = { 5,4,6,8,7,0,1,3,2,9}; int s,e; s = 0; e = sizeof(a)/sizeof(a[0])-1; for(;s <= e;++s) printf("%d ",a[s]); printf("\r\n"); sortarray(a,0,e); for(s = 0;s <= e;++s) printf("%d ",a[s]); return(0);}void sortarray(int a[],int s,int e){ if(s == e)return;//出口 int i = s,j = e,key = a[s];//边界和基数 while(i < j) { while(i < j && key < a[j])//后往前 --j; if(i < j) a[i] = a[j]; while( i< j && key >= a[i])//前往后 ++i; if(i < j) a[j] = a[i]; } a[i] = key;//i == j sortarray(a,s,i);// sortarray(a,i+1,e);}