#include<stdio.h>
int main(){
int a=3;
int b=5;
printf("交换前:a=%d b=%d",a,b);
a=a^b;//(a:3:011 b:5:101 ---- a=110)(按位(二进制位)易或 ;相同为0,相异为1)
b=a^b;//(a:110 b:5:101 ---- b=011)
a=a^b;//(a:110 b:011 ---- a=101 )
printf("交换后 a=%d b=%d",a,b);
return 0;
}
08-14
774
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-19