a^ =b ^ =a^=b;
这就是简单的异或运算。
#include<stdio.h>
int main()
{
int a=1,b=3;
a=b=a^=b;
printf(“a=%d,b=%d”,a,b);
return 0;
}
不需要中间值,简单又方便,在我们写变量很多的代码时非常有用,这也就告诉我们要灵活运用c语言中的各种运算
a^ =b ^ =a^=b;
这就是简单的异或运算。
#include<stdio.h>
int main()
{
int a=1,b=3;
a=b=a^=b;
printf(“a=%d,b=%d”,a,b);
return 0;
}
不需要中间值,简单又方便,在我们写变量很多的代码时非常有用,这也就告诉我们要灵活运用c语言中的各种运算