Figure 17-2
Machine-Level View of a Pointer
Variable
dereferences intPtr and stores the value 28 into beta. This statement represents indirect addressing of beta; the machine first accesses intPtr, then uses its contents to locate beta. In contrast, the statement
beta = 28;
represents direct addressing of beta. Direct addressing is like opening a post office box (P.O. Box 15, for instance) and finding a package, whereas indirect addressing is like opening P.O. Box 15 and finding a note that says your package is sitting in P.O. Box 23.
Direct Addressing Accessing a variable in one step by using the variable name.
Indirect Addressing Accessing a variable in two steps by first using a pointer that gives the location of the variable.
Continuing with our example, if we execute the statements
Figure 17-3
Abstract Diagram of a Pointer Variable