next up previous
Next: Pointer Operators Up: Overview of C++ Previous: Returning Reference

Pointers

A pointer is a variable that contains a memory address. Very often this address is the location of another variable. For example, if x contains the address of y, then x is said to point to y. A pointer variable must be declared as such. The general form of a pointer variable declaration is

type *var_name;

Here type is the pointer's base type; it is must be a valid C++ type. var_name is the name of the pointer variable. For example, to declare p to be a pointer to an integer, use this declaration

int *p;

For a float pointer use
float *p;



 

Yousef Haik
2/23/1998