+ 1

cout<<p<<endl; output-0x29fee8 how?

19th Jun 2016, 1:41 AM
Muskan gupta
Muskan gupta - avatar
3 odpowiedzi
+ 2
You're actually printing the memory address to which p is pointing to. If you want to print the actual value of the pointed cell just dereferentiate p: cout << *p;
19th Jun 2016, 3:03 AM
Francesco Galisi
Francesco Galisi - avatar
0
it will print the address of the variable which the pointer holds
22nd Jun 2016, 4:13 PM
gandhiyash
0
u have not initialized p so garbage value is default for auto storage class variables
21st Oct 2016, 10:02 PM
PANKAJ KUMAR
PANKAJ KUMAR - avatar