Hi all,
I’m learning address of operator ‘&’ lecture and I have a question that why we can’t directly retrieve the address of a char variable.
For example, the code in the lecture:
char ch = 'A';
cout << &ch << endl; // Result is 'A'
// Explicit typecasting from char* to void*
cout << (void*)&ch << endl; // Result is the address of ch variable
What exactly operator<< function did? And why we have to explicit typecasting it from char* to void* (or int*), what does void* mean in this case?
Thank you so much for your help