⚙️Pointer
Also known as Pointers, Memory Address, Null Pointer
A value that points to where other data is kept.
Think of it like
Think of it like a note with a house address on it. The note is not the house, but it tells you where to go.
Example
Emma stores 9 in a variable called age. A pointer p holds the address of age. Reading *p gives back 9.
Why it matters
Pointers are how programs pass big data around cheaply. They are also behind many crashes when they point at nothing.
Definition
Example code
c
int age = 9;
int *p = &age; // p holds the address of age
printf("%d\n", *p); // prints 9Common mistake
Key takeaways
- 1An address. Not the data itself.
- 2Share, do not copy. Many parts, one piece of data.
- 3Check before use. Null pointers crash.