If you want to access the address of a pointer, i.e. the address where the pointer is stored (and not the address the pointer stores!). Is this the correct way of doing it?
1 2 3 4
int d = 10;
int* e = &d;
cout << &e << endl << &d; //returns the address where e pointer is stored and the address where d is stored
cout << e << endl; //returns the address that the e pointer holds, i.e. the address of the d variable.
To my knowledge, yes.
(But it won’t work that way if you ‘cout’ a char* - that because std::cout has been overloaded to display the C-style string, in that case.)