Pointers for C Programmings
Pointers are variables that hold memory addresses, and they are the central idea of C. This unit covers address-of and dereference operators, pointer arithmetic, the link between arrays and pointers, and dynamic memory with malloc, calloc, realloc and free for data whose size is known only at run time.
Stage: Memory · Part of the C Programming roadmap · Last reviewed 19 November 2026
What to learn in Pointers
- Use the address-of and dereference operators to read and modify a variable
- Walk through an array using pointer arithmetic
- Allocate an array with malloc and release it with free
- Detect a memory leak and a dangling pointer in sample code
- Pass pointers to a function to return multiple results
Pointers interview questions
What is a dangling pointer?
A dangling pointer refers to memory that is no longer valid, such as after free or when pointing to a local variable that went out of scope. Using it is undefined behaviour. Setting a pointer to NULL after freeing helps avoid it.
What is the difference between malloc and calloc?
malloc allocates a block of given size with uninitialised contents. calloc takes a count and element size, allocates the block and zeroes it, and can detect multiplication overflow. Both return NULL on failure and need free.
Where Pointers fits in the C Programming roadmap
Pointers belongs to the Memory stage (intermediate level), which takes about 30 hours. Pointers and the heap.
Other units in this stage
Back to the full C Programming roadmap