The C language provides bitwise operations so that the C language can directly write system programs like assembly, and bit operations can effectively save memory in some scenarios with relatively strict memory; the C language provides the following bitwise operations: & bitwise AND if the two corresponding binary bits are both 1, The result value of this bit is 1, otherwise it is 0 | one of the two corresponding binary bits is 1, the result value of this bit is 1 ^ bitwise OR 0 if the two binary values involved in the operation are the same; otherwise, it is 1 ~ Bitwise inversion is used to reverse a binary number by bit, that is, 0 is changed to 1, and 1 is changed to 0 <left shift is used to shift all the binary bits of a number to N places left, right complement 0> right shift shifts the binary digits of a number to the right shift N places, and moves them to the right low position to be discarded. For the unsigned number, add 0 at the high position. For example: [cpp] # include <stdio. h> int main () {short a1 = 521; short a2 = 123; short And, Or, Not, AndOr; And = a1 & a2; Or = a1 | a2; not = ~ A1; AndOr = a1 ^ a2; printf ("a1, a2 bits And: % d \ n", And); printf ("a1, a2 bits or: % d \ n ", Or); printf (" a1, a2 bit: % d \ n ", Not); printf (" a1, a2 bit: % d \ n ", AndOr); return 0 ;}