多定义一个空的数组,类似于交换三个数字,需要一个空的用来存放
#include <stdio.h>
int main()
{
int arr[] = {1,2,3,4,5,6};
int brr[] = {11,22,33,44,55,66};
int crr[6] = {0};
for (int i = 0; i < 5; i++)
{
crr[i] = arr[i];
arr[i] = brr[i];
brr[i] = crr[i];
}
for (int i = 0; i < 5; i++)
{
printf("%3d", arr[i]);
}
printf("\n");
for (int i = 0; i < 5; i++)
{
printf("%3d", brr[i]);
}
return 0;
}