Bitwise Operator
~ Bitwise complement
& Bitwise AND
| Bitwise OR
^ Bitwise exclusive OR
<< Bitwise left shift
>> Bitwise right shift
Bitwise operators work on the binary bits. In particular, bitwise complement, AND, OR, exclusive OR operate on all the bits of a word independently.
0110 first number
1010 second number
Bitwise AND 0010 result of bitwise AND
That is 6 & 10 gets 2.
Previous slide
Next slide
Back to first slide
View graphic version