A pointer is a special type of variable that holds a memory address; that is, a pointer references or "points to" a value in a specific memory location.
A variable that points to a value doesn't behave like that value type, and can't be converted to another value type; it merely points to that value.
In order for a pointer to work correctly, it must be referenced to the memory location or object to which you wish it to point. For the purposes of this example, we will refer to the memory location or object as the "pointee". A pointer is made to reference a pointee using the Address operator "&". For example:
y = 4;
ptr = &y;
In this example, the pointer "ptr" points to or references "y" (whose value is 4).
Before the data referenced by a pointer can be used, the pointer must be dereferenced.
Topics in this section: