A double pointer is also called a pointer. Its function is indirect reference. However, no matter which term is used, it is confusing. In fact, a pointer is a pointer, the so-called multiple pointers are actually pointers. They are used to store memory addresses.
When you want to obtain the memory address of an int variable, int * is used to declare the pointer. To obtain the memory address of a double variable, double * is used to declare the pointer, this is because they are not the same unit during addition and subtraction, but are determined based on their data type. If you only want to store a memory address, the pointer type is void.
Pointers can be used to store (the memory address of a variable). Therefore, pointers are a variable and occupy the memory space to store information. Where is the address of the pointer's memory space? The same use and operation sub-can be known, for example:
# Include <iostream>
Using namespace std;
Int main (){
Int p = 10;
Int * ptr = & p;
Cout <"p value:"<P
<Endl;
Cout <"p memory location: "<& P
<Endl;
Cout <"* ptr reference value: "<* Ptr
<Endl;
Cout <"ptr stored address value: "<Ptr
<Endl;
Cout <"ptr memory location: "<& Ptr
<Endl;
Return 0;
}
Execution result: