1 2 3 4 5 6 7 8 9 10 11 12
#include <stdio.h> #define SWAP(x,y) ((y) ^= (x), (x) ^= (y) , (y) ^= (x)) int main(void) { int n1=24,n2=45; int *np1 = &n1,*np2 = &n2; SWAP(*np1,*np2); printf("n1=%d,n2=%d\n",n1,n2); return 0; }
1
n1=45,n2=24