Address of operator

when i do
char ch = ‘A’;
cout<<&ch<<endl;
then along with displaying A it also displays some garbage values with a space in next line.
why is it so?

@pushkar24sharma please share the exact code using CB IDE

maam it works fine on IDE but when i do this in my compiler then it shows the above output.
here is the ss of my code in my editor.

hi @pushkar24sharma you’ll have to typecaste it like this
cout << (void*)&ch;

characters behave a bit differently than the other datatypes with regards to this matter, it will be covered in the course as well.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like