Mega Code Archive

 
Categories / C++ Tutorial / Data Types
 

Printing the address stored in a char variable

#include <iostream> using std::cout; using std::endl; int main() {    char *word = "again";       cout << "Value of word is: " << word << endl         << "Value of static_cast< void * >( word ) is: "          << static_cast< void * >( word ) << endl;    return 0; } Value of word is: again Value of static_cast( word ) is: 0x43e000