Pointer-Related Operators

I l @ ve RuBoard

Pointer-Related Operators

& is the address operator. When followed by a variable name , & gives the address of that variable.

* is the indirection or dereferencing operator. When followed by a pointer, * gives the value stored at the pointed-to address.

Example

&nurse is the address of the variable nurse .

 nurse = 22; ptr = &nurse; /* pointer to nurse */ val = *ptr; 

The net effect is to assign the value 22 to val .

I l @ ve RuBoard


C++ Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 314
Authors: Stephen Prata

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net