Lesson 21 of 50
cBitwise Operations
9 mins
Course progress42%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 21 of 50
c9 mins
Keep these ideas in mind as you work through the lesson.
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.