At a deep level, your computer works with bits—1s and 0s. But these get bundled up into more human readable things, like characters and arrays. This is called abstraction.
While abstractions are nice, sometimes we want to work directly with bits. You can do this with bit manipulation, which involves bitwise operations.
Bitwise operations include AND, OR, XOR, NOT, and Bit Shifts.
AND, for example, takes two bits and returns 1 if both bits are 1. Otherwise, it returns 0. OR returns 1 if either of the bits are 1.
Interview coming up?
Get the free 7-day email crash course. You'll learn how to think algorithmically, so you can break down tricky coding interview questions.
No prior computer science training necessary—we'll get you up to speed quickly, skipping all the overly academic stuff.
No spam. One-click unsubscribe whenever.
You're in! Head over to your email inbox right now to read day one!