how can we display the address of char variable? I have found a solution using type casting by fist converting it to int or float or void etc. and then displaying address using pointers. But is there any other alternative to particular solution without type casting? using pointers like
char var = 'a';
char* ptr;
ptr = &var;
cout << ptr;
but in this case even the pointer is pointing to the address of var but displays the value of var. why? and if its so then how do we get he address of var using pointers? without using type casting
cout << "Address of var = " << static_cast<void*>(&var) << endl;
or we have to overload any operator for particular problem?