Character types
- Narrow character types:
- char
- signed char
- unsigned char
- Wide character type
wchar_t
The char
specifier is an integral type.
The wchar_t
type specifier is an integral type that
has enough storage to represent a wide character literal. (A wide
character literal is a character literal that is prefixed with the
letter L
, for example L'x'
)
A char
is a distinct type from signed
char
and unsigned char
, and the three types
are not compatible.
For the purposes of
distinguishing overloaded functions, a C++ char
is
a distinct type from signed char
and unsigned
char
.
If it does not matter if a char
data
object is signed
or unsigned
, you
can declare the object as having the data type char
.
Otherwise, explicitly declare signed char
or unsigned
char
to declare numeric variables that occupy a single byte.
When a char
(signed
or unsigned
)
is widened to an int
, its value is preserved.
By default, char
behaves like an unsigned char
. To change this
default, you can use the CHARS option or the #pragma chars directive.
See #pragma chars and CHARS in the
z/OS XL C/C++ User's Guide for more
information.