标签:turn 逆置 clu print pac printf -- temp stdio.h
#include<stdio.h>void fun(int a[], int n){
int i,j,temp;
for(i = 0,j = n-1; i < j; i ++,j --){// 交换时 i< j即可完成
temp = a[i];
a[i] = a[j];//
a[j] = temp;
}
for(j = 0;j < n; j++){
printf("%d",a[j]);
}
}
int main(void){
int a[] = {1,2,3,4,5,6,7,8,9};
fun(a,9);
return 0;
}
标签:turn 逆置 clu print pac printf -- temp stdio.h
原文地址:http://blog.51cto.com/13645380/2154817