int *i = new int;
cout << &i << endl << i;
delete i;
i = 0;
i get this output:
0031FB2B
0057C200
Why 2 di
&i
is the address of the pointer. This is the place where the value returned by new
will be stored. i
is the value of the pointer itself, this is the value returned by new
.
And just for completeness, *i is the value of the integer pointed to, which at the moment is uninitialized, but this is where your actual data will go.