Lesson 21 of 50 · c
Bitwise Operations
Duration: 9 mins
Bitwise operators work directly on the binary representation of integers.
| Operator | Meaning |
|---|---|
& | AND – set bits that are 1 in both operands |
| ` | ` |
^ | XOR – set bits that are 1 in exactly one operand |
~ | NOT – flips every bit |
<< | Left shift – multiplies by 2ⁿ (adds zeros on the right) |
>> | Right shift – divides by 2ⁿ (implementation‑defined for signed) |
Common uses: flags, masks, low‑level device drivers, graphics.