爲什麼值的NULL指針的地址不同 我有一個示例程序下面我試圖理解空指針的概念。這裏& q打印不同的地址,'q'給出0這是什麼原因。在C++中的NULL指針
#include <iostream>
using namespace std;
int main()
{
int *q=NULL;
cout <<"adress of pointer q\n" << q<<endl;
cout <<"adress with apersand pointer q\n" << &q<<endl;
}
&q和q不一樣的原因是什麼?如果地址是0,那麼爲什麼與&我得到一個memeory地址。上面的 – Step
我解釋了爲什麼nullpointer q打印值爲0.地址不爲零,所以&q打印內存位置。 – Aryan