Introduction to Pointers
Lesson 1 of 14 in Coddy's C++ Pointers course.
Pointers are a special type of variable that instead of holding variable values, they hold memory addresses. They always represent an address of a memory location, or point towards a value at a given address.
This indirect access to values offers many benefits in programming. Understanding how pointers work is essential for tasks like dynamic memory allocation, passing arguments or parameters to a function by reference, etc.

Here's a visual image of how pointers work. The variable var has a value of 5, so it's probably an integer (int), its location in the memory is 0x61ff08, and that's why the value of the pointer pointVar which isn't actually a value, but instead, it's a memory address of where the variable is stored is 0x61ff08. So now, we can say that the pointer pointVar points to the variable var on memory location 0x61ff08 which has a value of 5
- Variables contain values for the data (direct referencing)
- Pointers contain addresses of variables (indirect referencing)
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
Try it yourself
This lesson doesn't include a code challenge.
All lessons in C++ Pointers
1Pointer Fundamentals
Introduction to PointersDeclaration & InitializationArithmetic - AssignmentArithmetic - OperationsConst PointersPointers & Arrays2Pointers & References
Pointers as ParametersReferences - &References as ParametersPointers vs References