C++ Pointers
A pointer is a variable that holds a memory of the memory address of another variable of same type.
-
This memory address is the location of another variable where it has been stored in the memory.
-
It supports dynamic memory allocation routines
-
We can get the memory address of a variable by using the &
operator:
Example1:

Output :

A pointer however, is a variable that stores the memory address as its value.
A pointer variable points to a data type (like int
or string
) of the same type, and is created with the *
operator. The address of the variable you're working with is assigned to the pointer:
Example2:

Output :
