C++ Pointer to Pointer (Multiple Indirection)
A pointer to a pointer is a form of multiple indirection, or a chain of pointers.
A pointer to a pointer is storing the address of a pointer inside another pointer.
Usually, a pointer contains the address of a variable. When we define a pointer to a pointer, the first pointer contains the address of the second pointer, and the second pointer points to the location that holds the actual value.
A pointer-to-pointer variable must be declared as follows, that is, placing two asterisks before the variable name. For example, the following declares a pointer to a pointer of int type:
int **var;
When a target value is indirectly pointed to by a pointer to another pointer, accessing that value requires the use of two asterisk operators, as shown in the following example:
Example
When the above code is compiled and executed, it produces the following results:
var 值为 :3000 *ptr 值为:3000 **pptr 值为:3000other extensions