-1
我一直在困惑顯示動態整數的地址。 當我輸出ptr和& ptr我收到兩個不同的地址,但我不確定哪個地址正確指向指針的值。動態int指針地址?
int main()
{
//Setting pointer to null.
int *ptr = NULL;
ptr = new int;
*ptr = 10;
//Displaying value the pointer is pointing to, and the address.
cout << "Value pointing to : " << *ptr << endl;
cout << "Address : " << ptr << endl;