#include #define PRINT(int) printf(#int " = %d\n",int) void main() { int x, y, z; // ^ exclusive OR one or the other but not both. x = 03; y = 02; z = 01; PRINT( x | y & z ); PRINT( x | y & ~z ); PRINT( x ^ y & ~z ); PRINT( x & y && z ); x = 1; y = -1; PRINT( ! x | x ); // ! is the NOT operator. PRINT( ~ x | x ); // remember over flow. // x = 0001, ~x = fffe ~x | x = ffff = -1, (~x | x) + 1 = 0 PRINT( x ^ x ); // ^ exclusive OR one or the other but not both. x <<= 3; PRINT( x ); y <<= 3; PRINT( y ); y >>= 3; PRINT( y ); }