This:
const char * terry = \"hello\";
cout<
prints hello
instead of the memory address of the \'h\'
.
cout
is overloaded so that when you give it a char*
, it will print as a pointer to a C-style string. So, it prints out the characters until it hits a null terminating character.
If you used printf
instead of cout
, you would see the address. You could also cast the pointer to another type, say (void*)
and you would also get the address.