Bitwise Operators
Suppose we have char a = 5, b = 3
. Note this is valid and C will interpret 5
as a character corresponding to 00000101
and 3
as 00000011
in binary
List
- Bitwise not
~
E.g~a = 11111010
- Bitwise and
&
E.ga & b = 0000001
- Bitwise or
|
E.ga | b = 00000111
- Bitwise xor
^
E.ga ^ b = 00000110
- Bitwise shift
>>
and<<
a >> 2 = 00000001
a << 3 = 00101000
These can be combined with assignment operators, e.g c ~= a