[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppChar
If you want to store more char's, then use a std::string [2,3] (C++ users only).
Prefer plain char over signed char and unsigned char [1,5]. Use string instead of an array of char[2,3].
The range of a char can be found at compile time with std::numeric_limits.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppChar
(C++) char
Data type (and thus a keyword) like int and double, that can hold a single character.const char myChar = 'R'; std::cout << myChar << std::endl;
If you want to store more char's, then use a std::string [2,3] (C++ users only).
Prefer plain char over signed char and unsigned char [1,5]. Use string instead of an array of char[2,3].
The range of a char can be found at compile time with std::numeric_limits.
From [4]: How do you pronounce "char"?
"char" is usually pronounced "tchar", not "kar". This may seem illogical because "character" is pronounced "ka-rak-ter", but nobody ever accused English pronounciation and spelling of being logical.'char' links
References
- 1) Bjarne Stroustrup. The C++ Programming Language (3rd edition).ISBN: 0-201-88954-4 4.10.16: 'Prefer plain char over signed char and unsigned char'
- 2) Bjarne Stroustrup. The C++ Programming Language (3rd edition).ISBN: 0-201-88954-4 Chapter 5.8.5: 'Use string rather then zero-terminated arrays of char'.
- 3) Herb Sutter and Andrei Alexandrescu. C++ coding standards: 101 rules, guidelines, and best practices. ISBN: 0-32-111358-6. Chapter 77: 'Use vector and string instead of arrays.'
- 4) Bjarne Stroustrup's homepage : http://www.research.att.com/~bs/bs_faq2.html#char
- 5) Bjarne Stroustrup. The C++ Programming Language (3rd edition).ISBN: 0-201-88954-4 C.14.8: 'Do not rely on signedness or unsignedness of char'
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
