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