Overview - Pointers to pointers
What is it?
Pointers to pointers are variables that store the address of another pointer. Instead of pointing directly to a value, they point to a pointer that then points to the value. This allows multiple levels of indirection, which can be useful for managing complex data structures or modifying pointers themselves. In C, this is written using double asterisks, like **ptr.
Why it matters
Without pointers to pointers, it would be difficult to change the address stored in a pointer from inside a function or to create complex data structures like dynamic arrays of strings. They let programmers write flexible and powerful code that can manipulate memory addresses at multiple levels. Without this concept, many advanced programming tasks would be cumbersome or impossible.
Where it fits
Before learning pointers to pointers, you should understand basic pointers and how they store addresses of variables. After mastering pointers to pointers, you can explore dynamic memory allocation, multi-dimensional arrays, and advanced data structures like linked lists and trees.