Pointers to Pointers


So far we have simply looked at pointers to standard variables. However, C++ also allows the use of pointers that point to other pointers. A pointer to a pointer is often referred to as multiple indirection. Because a pointer is simply an indirect method of accessing a variable, then a pointer to a pointer would be multiple indirection. To create a pointer to a pointer, we only need to add an asterisk (*) for each level of reference.

char x; char * y; char ** z; x = 'a'; y = &x; z = &y;

The truth is that you can program for years and never have a particularly compelling need to implement pointers to pointers. In addition, pointers to pointers will not be used in this book.




C++ Programming Fundamentals
C++ Programming Fundamentals (Cyberrookies)
ISBN: 1584502371
EAN: 2147483647
Year: 2005
Pages: 197
Authors: Chuck Easttom

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