### 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 10^{3}+ 1 x 10^{2}+ 5 x 10^{1}+ 7 x 10^{0}

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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.