Click here to Skip to main content
15,896,408 members

Response to: Help Pointers and chars in C++;

Revision 1
char *suit = "Hearts"; cout<<*suit; it prints Hearts;

It shouldn't, it should print the character 'H' only. What you do is, you dereference the pointer-to-char, so it is only a char. That's why it's only the char that is printed from your class.

If you wish the class to print the whole string, don't dereference the char pointer.
Posted 13-Nov-12 1:22am by Orjan Westin.
Tags: