Here's a preview from my zine, How Integers and Floats Work! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
meet the byte
You might have heard that a computer’s memory is a series of bits (Os and 1s)…
010100110101010110110111
but you only access them in groups of 8 bits - a byte!
01010011 1010101 10110111
2 ways to think about a byte
8 bits
an integer from 0 to 255
00000000
= 0
00000001
(8 bits!) = 1
(integer!)
00000010
= 2
01011001
= 89
you can’t just access 1 bit
Every byte in your computer’s memory has an address.
If you want to fetch 1 bit, you need to fetch the whole byte at that address and then extract the bit.
some things that are 1 byte
- the boolean
true
(in C)00000001
- the ASCII character F
01000110
- the red part of the colour
#FF00FF
11111111
most things are more than one byte
- integers and floats are Usually 4 bytes or 8 bytes
- strings are LOTS of bytes (for example, in UTF-8 a heart emoji is 3 bytes)
bytes weren’t always 8 bits
In the past, people experimented with lots of different byte sizes (2, 3, 4, 5, 6, 8, and 10 bits!)
But now we’ve standardized on 8 bits pretty much everywhere.
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!