Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Why are double pointers called pointer to pointers?


Asked by Leon Benson on Dec 09, 2021 FAQ



So, when we define a pointer to pointer. The first pointer is used to store the address of the variable. And the second pointer is used to store the address of the first pointer. That is why they are also known as double pointers.
Furthermore,
A double pointer is basically a pointer to pointer. A pointer denotes the address of a particular data-value (type maybe int,float,char or some user-defined data types). A pointer to pointer is the address of a address of a data.
Besides, A pointer to a pointer is called a double pointer. Lets say we have two pointers and a normal variable. The first pointer stores the address of a variable. The second pointer, which is the double pointer, stores the address of the first pointer.
Also Know,
We already know that a pointer points to a location in memory and thus used to store the address of variables. So, when we define a pointer to pointer. The first pointer is used to store the address of the variable. And the second pointer is used to store the address of the first pointer.
In addition,
A pointer is a variable that stores a memory address. Pointers are used to store the addresses of other variables or memory items. Pointers are very useful for another type of parameter passing, usually referred to as Pass By Address .