#include<stdio.h>
int main()
{
int arr1[] = { 1,2,3,4 };
int arr2[] = { 5,6,7,8 };
int sz = sizeof(arr1) / sizeof(arr1[0]);
int i = 0;
int j = 0;
for (i = 0; i < sz; i++)
{
j = arr1[i];
arr1[i] = arr2[i];
arr2[i] = j;
}
for (i = 0; i < sz; i++)
{
printf("%d ",arr1[i]);
}
printf("\n");
for (i = 0; i < sz; i++)
{
printf("%d ", arr2[i]);
}
printf("\n");
return 0;
}
交换两个数组(将AB两个数组进行交换)
最新推荐文章于 2024-09-01 10:42:03 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)