#include <iostream>
using namespace std;
int main() {
int var = 20; // 實際變量的聲明
int* ip; // 指針變量的聲明
ip = &var; // 在指針變量中,存儲var的地址
cout << "Value of var variable:";
cout << var << endl;
// 輸出在指針變量中存儲的地址
cout << "Address stored in ip variable:";
cout << ip << endl;
// 訪問指針中地址的值
cout << "Value of *ip variable:";
cout << *ip << endl;
system("pause");
return 0;
}
結(jié)果:

point.png