C++ Pointers
Working with memory addresses.
C++ Pointers
A pointer 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:
string food = "Pizza";
string* ptr = &food; // Output the memory address of food
Dereferencing
In the example above, we used the pointer variable to get the memory address of a variable (used together with the & reference operator). However, you can also use the pointer to get the value of the variable, by using the * operator (the dereference operator).