Ch 11 · Pointers · C
Topic 11 of 13 in C — Complete Tutorial (Beginner) — 3 lessons.
What is a Pointer?
A pointer is a variable that stores the memory address of another variable — it "points to" where a value lives in memory. Every variable sits at some address, and the & operator gives you that address. A pointer type is written with a *, like int *p. Pointers are what make C powerful and fast, letting you work directly with memory — and they are the foundation of arrays, strings, and dynamic memory.
Dereferencing: Reading and Changing
The * operator, when used on a pointer, "dereferences" it — meaning "go to the address and use the value there." So if p points to age, then *p reads age's value, and *p = 30 changes age itself through the pointer. This is how functions in C can modify the caller's variables — you pass the address, and the function changes the value at that address.
Pointers and Arrays
In C, arrays and pointers are closely linked: the name of an array is actually the address of its first element. This means you can walk through an array using pointer arithmetic — adding 1 to a pointer moves it to the next element. This connection is why arrays are passed efficiently to functions (only the address is passed, not a copy of all the data).