# Bits and Bytes

## ☯ All C++ Articles☯ All Articles

A new product.

Last updated on: .

Bits
The fundamental unit of computer memory is the Bit. We can think an electronic Switch as a Bit. Let an electronic Switch that we can set either ON or OFF. Here Off represents the value 0 and ON represents the value 1. Hence we can say a Bit has 2 values.

◕ If we have 8 Switches then we can put them on 256 different combinations.
Because 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 is equal to 256.

In other word we can say 1 Bit can hold 2 values and 8 Bit can hold 256 different values.
This 256 may be from 0 to 255 or -128 to +127.

◕ Each additional of a Switch doubles the number of combinations. For an example:

9-Switch can give us:
2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 x 2 = 512 different values.

In other word, 9 Bits can hold 512 different values. It may be from 0 to 511 or -256 to +255.

Same as:
16-Bit = 65,536 different values.
32-Bit = 4,294,672,296 different values.
64-Bit = 18,446,744,073,709,551,616 different values.

1 Byte = 8 Bits