A pointer is a variable that stores the hexadecimal address of the variable it is pointing to.
A pointer variable is declared like so:
type* pntr;type *pntr;
A memory address of a variable is obtained using the reference operator (&
). Example: &var
.
A pointer is dereferenced using the dereference operator (*
). Example: *pntr
.
Pointers can be incremented and decremented using the +
and -
arithmetic operators.
Arrays can be accessed by using a pointer to the first element and incrementing and decrementing as necessary.