#include <stdio.h>
void swap(int x, int *y);
int main(void) {
int a = 1;
int b = 2;
swap(a, &b);
printf("a = %d, b = %d\n", a
,b
);
return 0;
}
void swap(int x, int *y){
int temp;
temp = x;
x = *y;
*y = temp;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIHN3YXAoaW50IHgsIGludCAqeSk7CgppbnQgbWFpbih2b2lkKSB7CglpbnQgYSA9IDE7CglpbnQgYiA9IDI7CgkKCXN3YXAoYSwgJmIpOwoJCglwcmludGYoImEgPSAlZCwgYiA9ICVkXG4iLCBhLGIpOwoJCglyZXR1cm4gMDsKfQoKdm9pZCBzd2FwKGludCB4LCBpbnQgKnkpewoJaW50IHRlbXA7CgkKCXRlbXAgPSB4OwoJeCA9ICp5OwoJKnkgPSB0ZW1wOwp9