C++ output give two different address but why complier give two address instead of I am writing only one variable
void *p ; cout<<&p<<p;
void *p ; is an uninitialized pointer. So what you will have inside the pointer there is actual garbage. When you do &p, your returning the address of the pointer p. That's why they both return different values.
void *p ;
&p
p
2.1m questions
2.1m answers
60 comments
57.0k users