Bitwise operators
AND, OR, XOR and NOT on real bytes in C, printing numbers in binary, and why & and && give different answers.
- The skill
- Combine bytes bit by bit with AND, OR, XOR and NOT, and tell them apart from the logical operators.
- You make
- A 32-bit binary printer, a key check for a game door and a checksum that spots a damaged packet.
Premium lesson
£7.99 a month or £59 a year. Cancel any time.
Builds on 33 Final challenge: C. Free to try: C Foundations and the playground.
Passed
You can now
Step 1 of 7
exercise_1.c
You've reached the good stuff.
4 exercises in this lesson, checked as you type. Premium opens every lesson after Foundations, in all four courses.
C, 32-bit: int and pointers are 4 bytes