Pointers
Why these addresses are different?
1 2 3 4 5
|
int* p = new int(8);
cout << p << endl;
cout << &p << endl;
|
p is the address to the new integer that has the value 8.
&p is the address to the variable p stored on the stack.
Simplified: -> means points to.
&p -> p -> 8
Topic archived. No new replies allowed.