精華區beta CSSE 關於我們 聯絡資訊
請看某程式 #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
hexen2:不對,&pPointer是指標的位置,不是pValue的位置 03/16 17:44
saitoTK:我那有說&pPointer是pValue的位置? 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)
theaky:對吧...? 03/17 11:48
cplusplus:是呀 一般來說local variable會依序放在stack上 03/18 02:25
MelLynce:4 bits <-- 4 bytes ? 03/21 03:26