先整体倒序,再分两部分(从m处)分别倒序。
main() { int a[6]={5,4,9,1,10,2}; int m=2; int temp; for(int j=0;j<(6/2);j++) {temp=a[5-j]; a[5-j]=a[j]; a[j]=temp; } for(int k=0;k<(2/2);k++) { temp=a[1-k]; a[1-k]=a[k]; a[k]=temp; } for(int t=2;t<=(7/2);t++){ temp=a[7-t]; a[7-t]=a[t]; a[t]=temp; } for(int s=0;s<6;s++) printf("%d\t",a[s]); }