异或 ^ 相同0 不同1

void SWAP(int *a,int*b)
{
*a=*a^*b;
*b=*a^*b;
*a=*a^*b;

}

栗子

a=3 b=2

11 10  01

01 10   11

01 11   10

参考 深入理解计算机操作系统