程序如下:
#include<stdio.h>
void Array(int a[],int len){
int *p = a;
int i = 0;
int j = len-1;
int temp;
while(i<j){
temp = *(p+i);
*(p+i) = *(p+j);
*(p+j) = temp;
i++,j--;
}
}
int main(){
int arr[20]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
Array(arr,20);
for(int i = 0,i<20,i++){
printf("%d\t",arr[i]);
}
return 0;
} |
|