A single bit can store a binary piece of information. We can use it to distinguish between two states.
These two states could be represented by True \(T\) and False \(F\), but by convention we use \(1\) and \(0\).
We can combine bits to store more complex pieces of information. If we have \(n\) bits, we can distinguish between \(2^n\) states.
Eight bits together constitute a byte. This can represent one of \(2^8=256\) states.
We could also represent numbers using a decimal basis, so each element could take \(10\) states, and \(n\) elements could represent \(10^n\) states.
The choice of basis is an abstraction.
By convention (and in particular in C) we can represent numbers using their basis like: \(0b0100\) for a \(4\)-bit number, representing \(4\) in binary. The \(0b\) at the start indicates that what will follow is a number written in binary.
Could also write \(0d5322\) for \(5322\), in decimal.
Could write \(0x53A4\) for \(21412\) in hexidecimal.
Big-endian: Largest byte in first memory space. Little-endian: Largest byte in last memory space.
We will use a byte to describe natural numbers. This gives us a range of \(2^8=256\). As we include \(0\) the largest number here is \(255\).
We describe zero using all \(0\)s.
\(0=00000000\)
4 bits
\(2^4\) is \(16\)
use \(0\) to \(15\), \(0\) to \(f\).
can represent byte with 2 hex. \(16 x 16 = 2^8 = 256\) \(0xFA\)