Try Helios's answer first, but in a string, the location of the first character is also the location of the string. In this case, H is the first character. A more simple solution could be: cout << temp1;
std::cout has a overload for char* that prints out the C-string, so your method won't work like you expect. Hence why you must cast it to something like a void* before trying to print it.