#include <stdio.h>
void swap(int *a, int b);
int main(void)
{
int a[4] = {1, 2, 3, 4};
int b = 3;
swap(a+1, b);
printf("a[0] = %d, a[1] = %d, b = %d\n", a
[0], a
[1], b
);
return 0;
}
void swap(int *a, int b)
{
int temp;
temp = *a;
*a = b;
b = temp;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIHN3YXAoaW50ICphLCBpbnQgYik7CgppbnQgbWFpbih2b2lkKQp7CiAgICBpbnQgYVs0XSA9IHsxLCAyLCAzLCA0fTsKICAgIGludCBiID0gMzsKCiAgICBzd2FwKGErMSwgYik7CgogICAgcHJpbnRmKCJhWzBdID0gJWQsIGFbMV0gPSAlZCwgYiA9ICVkXG4iLCBhWzBdLCBhWzFdLCBiKTsKCiAgICByZXR1cm4gMDsKfQoKdm9pZCBzd2FwKGludCAqYSwgaW50IGIpCnsKICAgIGludCB0ZW1wOwoKICAgIHRlbXAgPSAqYTsKICAgICphID0gYjsKICAgIGIgPSB0ZW1wOwp9