Pointers
Objects (such as values of variables) are stored at a specific
location in the computer's memory. These locations are called memory
addresses. Pointers are variables that store the location of a specific
memory address. They are primarily used to to access arrays and create
data structures.
-
int object;
-
int *object_ptr;
-
Pointer Operators
-
* Dereference -- given a pointer,
obtain the object referenced
-
& Address of -- given an object,
get its address
-
thing -- a variable
-
&thing -- pointer to the variable
thing, i.e. the address of where "thing" is stored
-
thing_ptr -- a pointer to the location
at which the value of variable "thing" is stored
-
*thing_ptr -- the "thing" variable
-
working with pointers and arrays -- syntax
|