Reference Operator
Pointers are exactly what the name suggests. They point at something else. The first topic of pointers that is necessary to understand is the reference operator. A reference operator points at a location in memory rather than the actual value stored within that location. Imagine a piece of memory (A) at location 1000 for example is holding a value of 50.
Input
A = 50;
B = A;
C = &A;
Output
B=50
C=1000
B is the value of A and C is the location of A.
Dereference Operator
The following dereference example consists of (A) once again at location 1000 with a stored value of 50.
Input
A= 1000(memory location) [50 is stored here]
B= *A
Output
B= Value of the location A is equivalent to. (50)
Thursday, April 9, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment