Click here to Skip to main content
14,430,746 members
Rate this:
Please Sign up or sign in to vote.
See more:
i know to see the address of different variables having different datatypes but i see during my practice that address of char type of variable is not shown
tell me why the compiler did not show the address for character type of variable like the others int ,float etc

What I have tried:

i know this method to see the address of any type of variable
char a;
cout<< &a <<endl;

if u know any other method then tell me
Thanks
Posted
Updated 21-Jun-18 8:18am
Rate this:
Please Sign up or sign in to vote.

Solution 1

cout << reinterpret_cast<void *>(&a) << endl;


(the << operator overload for char * argument assumes it is dealing with a C-like string)
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

You could learn the answer to all these basic questions by getting hold of a good book on C or C++, or finding an online tutorial.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100