Bit-Wise Operators
- These can even be combined with the assignment operator.
Unsigned char a=5, b=3:
- Bitwise not ~
- c = ~ a ; gives c = 11111010
- Bitwise and &
- c = a&b ; gives c = 00000001
- Bitwise or |
- c = a|b ; gives c = 00000111
- Bitwise exclusive or ^
- c = a^b ; gives c = 00000110
- Bitwise shift right or left >> and <<
- c = a >> 2; gives c = 00000001
- c = a << 3; gives c = 00101000