4.11 Wide Characters
The problem with the char data type is that it was
designed to hold only a basic character set. This is fine for all the
American characters, but what about foreign languages? That where
the wchar_t data type comes in. It
is used to specify "wide
characters" which include not only the basic
American characters, but foreign characters as well. A wide character
is declared just like a simple character:
char simple; // A simple character
wchar_t wide; // A wide character
A simple character is declared by putting the character inside single
quotes: 'X'. A wide character uses an
"L" prefix to indicate that it is a
wide character: L' '
.
For example:
- simple = 'X';
- wide = L'
';
|