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