개발/C
[C] Swap의 구현
Remover
2012. 2. 8. 06:43
#include <stdio.h>
#define SWAP(a,b) ((a) ^= (b) ^= (a) ^= (b))
int main(void)
{
int a = 5;
int b = 10;
SWAP(a,b);
printf("a = %d, b = %d\n", a, b);
/* make compiler happy :) */
return 0;
}
반응형