Character types

Character types fall into the following categories:

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')

C only A char is a distinct type from signed char and unsigned char, and the three types are not compatible.

C++ only 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 DFTCHAR(*SIGNED|*UNSIGNED) option or the #pragma chars directive. See DFTCHAR(*SIGNED|*UNSIGNED) in the ILE C/C++ Compiler Reference for more information.

Related information



[ Top of Page | Previous Page | Next Page | Contents | Index ]