Next | The Identity Function | 21 |
I = 1 + (address(A(I)) - address(A)) / SIZE
Now, suppose FOO is any object at all
Even one not in the array
I = 1 + (address(FOO) - address(A)) / SIZE
We can compute I from this formula as if it were in the array
Then if we asked for A(I), we would get back FOO
So if PTR is any pointer at all, and I is computed as follows:
I = 1 + (PTR - address(A)) / SIZE
Then A(I) is the value pointed to by PTR
In C we would write *ptr
Next | Copyright © 2001 M. J. Dominus |