This code:
string str1 ( "Hello world" );
const char *c_str1 = str1.c_str ( );
cout << "The C-style string c_str1 is: " << c_str1
generates this output:
The C-style string c_str1 is: Hello world
and I do not understand it.
c_str1
is a pointer, right? So, c_str1
should return an address and only *c_str1
should give the value located at this address. However, in the above example c_str1
gives the value (not the address).
What do I misunderstand?