Binary Numbers, Bits, and Bytes
The usual way to write numbers is based on the number 10. For example, 2157 has a 2 in the thousands place, a 1 in the hundreds place, a 5 in the tens place, and a 7 in the ones place. This means you can think of 2157 as being the following:
2 x 1000 + 1 x 100 + 5 x 10 + 7 x 1
However, 1000 is 10 cubed, 100 is 10 squared, 10 is 10 to the first power, and, by convention, 1 is 10 (or any positive number) to the zero power. Therefore, you can also write 2157 as this:
2 x 103 + 1 x 102 + 5 x 101 + 7 x 100
Because our system of writing numbers is based on powers of ten, we say that 2157 is written in base 10.
Presumably, the decimal system evolved because we have ten fingers. A computer bit, in a sense, has only ...
Get C Primer Plus, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.