#include<stdio.h>
int main(){
int arr1[]={1,3,5,7,9};
int arr2[]={2,4,6,8,9};
int tmp;
int i=0;
for(i=0;i<sizeof(arr1)/sizeof(arr1[0]);i++){
temp=arr1[i];
arr1[i]=arr2[i];
arr2[i]=temp;
}
for(i=0;i<sizeof(arr1)/sizeof(arr1[0]);i++){
printf("%d",arr1[i]);
}
printf("\n");
for(i=0;i<sizeof(arr1)/sizeof(arr1[0]);i++){
printf("%d\n",arr2[i]);
}
return 0;
}
如何交换两个数组的内容
最新推荐文章于 2023-08-10 16:45:56 发布