& is reference operator
* is deference operator
<><><><><><><>
int p=10; assuming p address is 1200.
so &p is 1200 and p is 10. In this case : & = address of
<><><><><><><>
POINTER
int * q
q = &p ==> q is containing address!
*q = 11 ==> *q is containing value, in this case : * = value pointed by
Important :
int * q and *q, those 2 * (stars) have diffrent meaning.
One is denotes a pointer (not variable nor constant value).
One is deference operator.
><><><><><><><
End result : p is 11.
Excerpt from : http://www.cplusplus.com/doc/tutorial/pointers/
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment