#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
int a[6] = {1,3,5,7,9,11};
int b[6] = { 2,4,6,7,8,10 };
int i = 0;
int t = 0;
for (i = 0; i < 6; i++)
{
t = a[i];
a[i] = b[i];
b[i] = t;
}
for (i = 0; i < 6; i++)
{
printf("%d ", a[i]);
}
printf("\n");
for (i = 0; i < 6; i++)
{
printf("%d ", b[i]);
}
return 0;
}
【一维数组】交换数组
最新推荐文章于 2024-11-14 19:06:32 发布