2 Pointers

The concept of pointers is not unique to C++. From the start, the C language has the construct of pointers. The concept of a pointer is both primitive and advanced. It is primitive because accessing memory by the address of variables can be done by simple low level instructions.

It is advanced because the use of pointers permits the implementation of complex data structures.

References in C++ can take the place of pointers in C in many cases. This is especially the case in passing parameters. However, references can only be initialized to become the alias of an object once. After that, a reference cannot become the alias of another object.

A non-const pointer, however, can store the address of different objects at run time. This one property of a pointer makes it different from a reference.



Copyright © 2006-09-21 by Tak Auyeung