#define _CRT_SECURE_NO_WARNINGS 1 //将数组A中的内容和数组B中的内容进行交换。(数组一样大) int main() { int arr1[] = { 1, 3, 5, 7, 9 }; int arr2[] = { 2, 4, 6, 8, 10 }; int i; for (i = 0; i < sizeof(arr1)/4; i++) { int tem = arr1[i]; arr1[i] = arr2[i]; arr2[i] = tem; } for (i = 0; i < sizeof(arr1)/4; i++) { printf("%d ", arr1[i]); } printf("n"); for (i = 0; i < sizeof(arr1)/4; i++) { printf("%d ", arr2[i]); } return 0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)