0

Tell the reason

I am writing at the end of program.. Cout<< p; Cout << &p; It giving different memory address what does it mean ??

14th Feb 2020, 1:47 PM
Ashish Kumar
Ashish Kumar - avatar
2 odpowiedzi
+ 4
Assuming 'p' is some pointer, then cout << p; will give you the memory adress of the cell the pointer is currently pointing to, while cout << &p; will give you the memory adress of the pointer variable itself, since a pointer is also a variable that sits on the stack and therefore has a memory adress.
14th Feb 2020, 1:57 PM
Shadow
Shadow - avatar
0
Thnx bro
14th Feb 2020, 2:38 PM
Ashish Kumar
Ashish Kumar - avatar