Pointers are the idea that makes C feel different, and once you see it, it is simpler than it looks.
Direct answer
A pointer is a variable that holds a memory address. Use & to get an address and * to follow a pointer to the value it points to. Pointers let functions modify variables, work with arrays and strings and manage memory manually.
The basics
#include <stdio.h>
int main(void) {
int x = 10;
int *p = &x; // p holds the address of x
printf("%d\n", x); // 10
printf("%p\n", (void *)p); // an address
printf("%d\n", *p); // 10, the value at that address
*p = 20; // changes x
printf("%d\n", x); // 20
return 0;
}
Passing by pointer
void increment(int *n) {
*n = *n + 1;
}
int main(void) {
int a = 5;
increment(&a);
printf("%d\n", a); // 6
return 0;
}
Common mistakes
- Using a pointer before it points to anything.
- Dereferencing
NULL. - Forgetting that
*in a declaration means "pointer to".
Where Teyro fits
Teyro's C for Beginners course turns this into short lessons you can play in a few minutes a day. It has 78 lessons, and you can start free.
The bottom line
Think of a pointer as a house address. The address is not the house, but it tells you where to go.


