int* pInt = new int; *pInt = 5; cout << "---------------" << endl; cout << "&(*pInt)-->" << &(*pInt) << endl; cout << "pInt-->" << pInt << endl; cout << "&pInt-->" << &pInt << endl; delete pInt; cout << "---------------" << endl; //cout << "*pInt-->" << *pInt << endl; cout << "pInt-->" << pInt << endl; cout << "&pInt-->" << &pInt << endl; pInt = nullptr; cout << "---------------" << endl; //cout << "*pInt-->" << *pInt << endl; cout << "pInt-->" << pInt << endl; cout << "&pInt-->" << &pInt << endl;
輸出
---------------
&(*pInt)-->00947918
pInt-->00947918
&pInt-->0078FA4C
---------------
pInt-->00008123
&pInt-->0078FA4C
---------------
pInt-->00000000
&pInt-->0078FA4C