Pointer Value and the Address-of Operator &
Values of pointers
Being variables themselves, pointers also have values. The default value of a pointer is the special value
null, which means that the pointer is not pointing at any variable yet (i.e., does not provide access to any variable).
To make a pointer provide access to a variable, the value of the pointer must be set to the address of that variable. The pointer starts pointing at the variable that is at that specific address. From now on, we will call that variable the pointee.
& operator, which we have used many times before with
readf, was also briefly mentioned in the value types and reference types chapter. This operator produces the address of the variable that is written after it. Its value can be used when initializing a pointer:
int myVariable = 180;
int * myPointer = &myVariable;
myPointer by the address of
myPointer point at
The value of the pointer is the same as the address of