Printing the address stored in a char* variable : address of « Pointer « C++ Tutorial






#include <iostream>
using namespace std;
int main()
{
   char *string = "test";

   cout << "Value of string is: " << string
        << "\nValue of static_cast< void *>( string ) is: " 
        << static_cast< void *>( string ) << endl;
   return 0;
}








11.4.address of
11.4.1.Address of operator and addresses of local variables
11.4.2.Demonstrating the Address-of Operator
11.4.3.Printing the address stored in a char* variable