

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Memory
incomplete
2: What Is an Address?
incomplete
3: Virtual Memory
incomplete
4: Pointers
incomplete
5: Why Pointers?
incomplete
6: Pointer Basics
incomplete
7: Pointers to Structs
incomplete
8: C Arrays
incomplete
9: Arrays As Pointers in C
incomplete
10: Multibyte Arrays
incomplete
11: Array Casting
incomplete
12: Pointer Size
incomplete
13: Arrays Decay to Pointers
incomplete
14: C Strings
incomplete
15: C String Library
incomplete
16: Forward Declaration
incomplete
17: Mutual Structs
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
You've probably heard of pointers. You may have also seen jokes about how they are impossible to learn... Well, that's wrong.
In fact, now that you understand how memory is laid out in an array, a lot of the mystery behind pointers should be gone. Put simply: a pointer is just a variable that stores a memory address. It's called a pointer, because it "points" to the address of a variable, which stores the actual data held in that variable.
Click to play video
A pointer is declared with an asterisk (*) after the type. For example, int *.
int age = 37;
int *pointer_to_age = &age;
Remember, to get the address of a variable so that we can store it in a pointer variable, we can use the address-of operator (&).