As with all other variables, a pointer has no meaningful value until one is assigned to it. Any variable declaration merely states what value the variable is capable of holding. We must assign a meaningful value to the pointer.
A pointer variable holds the address of another named location. This is the target of the pointer. A pointer points to another variable's location. That variable's value is its target. The way to assign an address value to a pointer is to use the & operator and the variable identifier, as follows:
int height;
int* pDimension;
pDimension = &height;
This assigns the address of the heightnamed location to the pDimensionpointer variable. As we previously mentioned, we don't care about the specific value of&height. But now, we know thatpDimensionpoints to the same memory location asheight. Another way to express this is thatheightis the current target ofpDimension.
...