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