#include <stdio.h>
void swap(int *x,int *y);
int main(void) {
int data1[] = {1,2,3,4,5};
int data2[] = {6,7,8,9,10};
int n = sizeof(data1)/sizeof(data1[0]);
for(int i=0;i<n;i++){
swap(&data1[i],&data2[i]);
}
for(int i=0;i<n;i++){
printf("data1[%d]=%d,data2[%d]=%d\n",i
,data1
[i
],i
,data2
[i
]); }
return 0;
}
void swap(int *x,int *y){
int w;
w = *x;
*x = *y;
*y = w;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIHN3YXAoaW50ICp4LGludCAqeSk7CgppbnQgbWFpbih2b2lkKSB7CglpbnQgZGF0YTFbXSA9IHsxLDIsMyw0LDV9OwoJaW50IGRhdGEyW10gPSB7Niw3LDgsOSwxMH07CgoJCglpbnQgbiA9IHNpemVvZihkYXRhMSkvc2l6ZW9mKGRhdGExWzBdKTsKCglmb3IoaW50IGk9MDtpPG47aSsrKXsKCQlzd2FwKCZkYXRhMVtpXSwmZGF0YTJbaV0pOwoJfQoJZm9yKGludCBpPTA7aTxuO2krKyl7CgkJcHJpbnRmKCJkYXRhMVslZF09JWQsZGF0YTJbJWRdPSVkXG4iLGksZGF0YTFbaV0saSxkYXRhMltpXSk7Cgl9CglyZXR1cm4gMDsKfQoKdm9pZCBzd2FwKGludCAqeCxpbnQgKnkpewoJaW50IHc7Cgl3ID0gKng7CgkqeCA9ICp5OwoJKnkgPSB3Owp9Cg==