Binary Numbers
All data inside the computer is represented by means of binary numbers. A binary (base 2) number has only two digit values: 0 and 1. A bit, an abbreviation of binary digit, can be either 0 or 1; a bit is the basic unit of memory. We can use a sequence of bits to represent a number. A binary number such as 111001 represents:
1 | 2^5 = | 32 | |
+ | 1 | 2^4 = | 16 |
+ | 1 | 2^3 = | 8 |
+ | 0 | 2^2 = | 0 |
+ | 0 | 2^1 = | 0 |
+ | 1 | 2^0 = | 1 |
= | 57 |
We can also use a bit to represent false ( 0) or true ( 1). Several Boolean functions are defined:
A byte is a sequence of 8 bits; it can be used to represent a character by assigning a character code to each character.