[語法] 取址運算子" & "
請看某程式
#include <iostream.h>
int main()
{
int pValue=5;
int *pPointer=&pValue;
cout << "pValue \t " << pValue << "\n";
cout << "Value at pPointer\t" << *pPointer << "\n";
cout << "address of pPointer\t" << pPointer << "\n"; // pPointer的位址
}
最後一行輸出pPointer位址的時候,括號內為觀念
若作&*pPointer(pPointer該指標的位置內所儲存數值之位置,即pValue的位置)
數出值:0012FF88
作&pPointer(pPointer這個指標在記憶體的位置)
數出值:0012FF84
作pPointer (pValue在記憶體的位置)
數出值:0012FF88
不同電腦的記憶體位址不會一樣, 但都會差4bits
以上的觀念對嗎?
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.71.94.7
→
03/16 17:44,
03/16 17:44
→
03/16 18:04,
03/16 18:04
--
傳說中的R580在這裡 低調分享~~~
http://www.flickr.com/photos/saitotk/89218026/
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.64.83.18
※ 編輯: saitoTK 來自: 210.64.83.18 (03/16 18:07)
※ 編輯: saitoTK 來自: 210.64.83.18 (03/16 18:07)
※ 編輯: saitoTK 來自: 210.64.83.18 (03/16 18:08)
※ 編輯: saitoTK 來自: 210.64.83.18 (03/16 18:08)
推
03/17 11:48, , 1F
03/17 11:48, 1F
推
03/18 02:25, , 2F
03/18 02:25, 2F
→
03/21 03:26, , 3F
03/21 03:26, 3F
CSSE 近期熱門文章
PTT數位生活區 即時熱門文章