Zhang Hua posted: 2016-02-19Copyright Notice: can be reproduced freely. When reproduced, please be sure to indicate the original source and author information and this copyright notice in the form of a hyperlink .(http://blog.csdn.net/quqi99)
-bit Operation&: With operation, both 1 is 1, otherwise 0
|: or action. There is a 1 for 1, otherwise 0
^: XOR or operation, the difference is 1, otherwise 0
~: Reverse, place 1 to 0, 0 to 1
<<: shift left, e.g. 0000 <<3 = 0100 0000, shift left one equals to 2
>>: Shift left, such as: 0000 1000>>3=0000 0001, shift right one equivalent to descending to 2
The proportions are as follows:
Reg |= (1<<n), the nth position of Reg 1 (where 1 is represented as: 0000 0001)
Reg | = (1<< 7) | (1<< 4) | (1<< 0), 8th, 5 and 1 position 1 will be set
Reg &= (1<<n), place reg Nth Position 0
(WIP) C Language Knowledge recall (by quqi99)