#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+IAogCnZvaWQgc3dhcChpbnQgKmEsIGludCBiKTsgCiAKaW50IG1haW4odm9pZCkgCnsgCiAgICBpbnQgYVs0XSA9IHsxLCAyLCAzLCA0fTsgCiAgICBpbnQgYiA9IDM7IAogCiAgICBzd2FwKGErMSwgYik7IAogCiAgICBwcmludGYoImFbMF0gPSAlZCwgYVsxXSA9ICVkLCBiID0gJWTCpW4iLCBhWzBdLCBhWzFdLCBiKTsgCiAKICAgIHJldHVybiAwOyAKfSAKIAp2b2lkIHN3YXAoaW50ICphLCBpbnQgYikgCnsgCiAgICBpbnQgdGVtcDsgCiAKICAgIHRlbXAgPSAqYTsgCiAgICAqYSA9IGI7IAogICAgYiA9IHRlbXA7Cn0=