Click here to Skip to main content
12,698,253 members (22,567 online)
Click here to Skip to main content

Tagged as



Help Pointers and chars in C++;

, 13 Nov 2012 CPOL
When I do this: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...



Compare Revision Minor Date Status Editor
2 - publicly available No 12-Nov-12 21:24 Available Orjan Westin
Updates in content. 12 changes had been made.
1 No 12-Nov-12 21:22 Available Orjan Westin


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Orjan Westin
Software Developer (Senior)
United Kingdom United Kingdom
Orjan has worked as a professional developer - in Sweden and England - since 1993, using a wide range of languages (C++, Pascal, Delphi, C, C#, Visual Basic, PHP, Python and x86 assembler), but tends to return to C++.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170118.1 | Last Updated 13 Nov 2012
Article Copyright 2012 by Orjan Westin
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid