我新的C++和我有這樣一段代碼:C++指針地址解釋
int firstvalue=10;
int * mypointer;
mypointer = &firstvalue;
cout << "pointer is " << *mypointer << '\n';
cout << "pointer is " << mypointer << '\n';
cout << "pointer is " << &mypointer << '\n';
結果是:
pointer is 10
pointer is 0x7ffff8073cb4
pointer is 0x7ffff8073cb8
任何人都可以向我解釋爲什麼「的結果mypointer「和」& mypointer「是不同的?
非常感謝。
'mypointer'也是一個變量,所以它有自己的地址... –