< previous page page_971 next page >

Page 971
0971-01.gif
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.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif 3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Direct Addressing Accessing a variable in one step by using the variable name.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif 3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
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
0971-02.gif
Figure 17-3
Abstract Diagram of a Pointer Variable

 
< previous page page_971 next page >