#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int a, b;
a = 1, b = 2;
printf("a=%d,b=%d\n", a, b);
a = a ^ b;
b = a ^ b;
a = a ^ b;
printf("a=%d,b=%d\n", a, b);
system("PAUSE");
return 0;
}
解释:
b = a ^ b = (a ^ b) ^ b = a ^b ^ b = a ^ 0 = a;
a = a ^ b; 同上
望大家提出宝贵的意见