+ 1
Char pointer / i dont understand the output
char *var = "hello"; char *p = var; cout<<var; // outputs hello cout <<p; // outputs hello cout <<*p; // outputs h i dont understand why dont output this code addresses in memory? location? it seems to me different from int type pointets working. HELp.
5 Answers
+ 2
if you want to see address in Memory change it to
cout<<&p;
this code show you address of var character.
+ 2
write down code which i mentioned above you will see hex...
+ 1
but how can be the address of var hello and not a hex??
+ 1
oke, thanks, i am so confusing with this char pointer behavior.
0
chars are treated differently in c++ than other data types.