int main() {
int num,pi;
num=1;
num++;
int *p;
int **ptr;
pi=num;
p=#
*ptr=#
std::cout << "Hello, World!" << std::endl;
std::cout << "num=" << num << std::endl;
std::cout << "num地址:" << &num << std::endl;
std::cout << "p指针:" << p << std::endl;
std::cout << "&p引用:" << &p << std::endl;
std::cout << "&*p指针所指引用:" << &*p << std::endl;
std::cout << "*p指针所指:" << *p << std::endl;
std::cout << "**ptr=" << **ptr << std::endl;
std::cout << "*ptr=" << *ptr << std::endl;
std::cout << "ptr=" << ptr << std::endl;
std::cout << "&ptr=" << &ptr << std::endl;
std::cout << "&*ptr=" << &*ptr << std::endl;
std::cout << "&**ptr=" << &**ptr << std::endl;
return 0;
}
打印结果:
Hello, World! num=2 num地址:0x7ff7be1fd208 p指针:0x7ff7be1fd208 &p引用:0x7ff7be1fd1f8 &*p指针所指引用:0x7ff7be1fd208 *p指针所指:2 **ptr=2 *ptr=0x7ff7be1fd208 ptr=0x7ff7be1fd210 &ptr=0x7ff7be1fd1f0 &*ptr=0x7ff7be1fd210 &**ptr=0x7ff7be1fd208
进程已结束,退出代码0
|