如果 p 是一个指针,&p 是什么?

What does &p, if p is an pointer?

本文关键字:指针 是什么 一个 如果      更新时间:2023-10-16

我有一个关于指针和地址的问题,我已经搜索了,但是没有找到信息。

int* p = new int;
*p = 5;
std::cout << p; // Output the address of p.
std::cout << *p; //Output the value pointed by p.
std::cout << &p; // Output a address, but what address is that?

如果p是指针,那么&p到底是什么?

&p给出了指针p的地址。