标签:turn 操作符 行操作 \n 按位取反 取值 相同 void 编码
0 & 0 = 0
0 & 1 = 0
1 & 0 = 0
1 & 1 = 1
#include<stdio.h>
int main (void)
{
int n;
for(n=1;n<=20;n++)
if (0==(n&0x1))
printf("%d ",n);
printf ("\n");
return 0;
}
2 4 6 8 10 12 14 16 18 20
0 | 0 = 0
0 | 1 = 1
1 | 0 = 1
1 | 1 = 1
0 ^ 0 = 0
0 ^ 1 = 1
1 ^ 0 = 1
1 ^ 1 = 0
#include<stdio.h>
int main (void)
{
int a=3,b=5;
a=a^b;
b=a^b;
a=a^b;
printf("a=%d,b=%d\n",a,b);
return 0;
}
a=5,b=3
~0 = 1
~1 = 0
标签:turn 操作符 行操作 \n 按位取反 取值 相同 void 编码
原文地址:https://www.cnblogs.com/CH520/p/10146665.html