char *m_chString="asd";
cout<<m_chString;//prints asd
cout<<*m_chString;//prints a
int nValue = 7;
int *pnPtr = &nValue;
cout<<*pnPtr;//prints 7
cout<<pnPtr;//prints the address of nValue
I gave two examples, in the first the pointer points to a string, and in the second, the pointer prints to an int value.
My question is, why cout<<m_chString;
from the first example doesn't print the address of my string as it would do in the second example if I were to print pnPtr
without dereferencing it?
Doesn't pnPtr
point to an address?