Understanding data types
Everything in a computer is a sequence of binary digits (or bits). A single bit is either off (0) or on (1). Eight bits are strung together to form a byte. A byte is the basic unit of data. Bytes are treated singly, as pairs called 16-bit words, as quadruples to form 32-bit words, or as octets to form 64-bit words. These combinations of sizes of bytes are used in the following ways:
- As instructions for the CPU
- As addresses for the locations of all things in the computer
- As data values
The compiler generates binary instructions from our C statements; therefore, we don't need to deal with these binary instructions since we are writing proper C syntax.
Additionally, we interact with various parts of the computer via the address of that part. Typically, we don't do this directly. For instance, we've discussed how printf()
knows how to fetch the data from a function call we make and then move it to the part of the computer...