I don't understand that the root of level two pointers is that I don't know enough about the use of stacks by the program.
It is best to use a first-level pointer to easily modify the value of the pointer object, using a two-level pointer is preferably convenient to modify the pointer value.
#include <iostream>#include <stdio.h>using namespace STD;classhaha{};voidMain () {haha *p (Newhaha);printf("%p\n", p);//The address of the first level pointer printf("%p\n", &p);//referencing the address of a storage-level pointer printf("%p\n", *&p);the value stored by the//reference store-level pointer address cout<<"==================="<< Endl; haha **pp = &p;//Level two pointer stores a pointer address printf("%p\n", &PP);//referencing the address that stores a level two pointer printf("%p\n", *&PP);//reference store value stored in level two pointer address printf("%p\n", pp);//Address of level two pointer printf("%p\n", *PP);The value stored by the address of the//level two pointer Cin. get ();}
The results of the operation are as follows:
- &p 0x002dfd60 {0x002ea438 {...}} haha * *
&p 0x002ea438 {...} haha
pp 0x002ea438 {...} haha
- PP 0x002dfd60 {0x002ea438 {...}} haha * *
&PP 0x002dfd54
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
First-level pointers and two-level pointers