#include<stdio.h> //位操作符(只针对整数进行操作)
//& - 按(二进制)位与 (有0则0)
//| - 按(二进制)位或 (有1则1)
//^ - 按(二进制)位异或 (不同为1,相同为0)
int main()
{
int a = 3;
int b = -5;
//00000000000000000000000000000011------3的补码
//10000000000000000000000000000101------(-5)的原码
//11111111111111111111111111111010------(-5)的反码
//11111111111111111111111111111011------(-5)的补码
int c = a & b;
//00000000000000000000000000000011------3的补码
//11111111111111111111111111111011------(-5)的补码
//00000000000000000000000000000011------c的补码=原码=3
printf("c=%d\n",c); //3
int d = a | b;
//00000000000000000000000000000011------3的补码
//11111111111111111111111111111011------(-5)的补码
//11111111111111111111111111111011------d的补码
//11111111111111111111111111111010------d的反码
//10000000000000000000000000000101------d的原码=(-5)
printf("d=%d\n",d); //(-5)
int e = a ^ b;
//00000000000000000000000000000011------3的补码
//11111111111111111111111111111011------(-5)的补码
//11111111111111111111111111111000------e的补码
//11111111111111111111111111110111------e的反码
//10000000000000000000000000001000------e的原码=(-8)
printf("e=%d",e); //(-8)
return 0;
}