10.2.2 char Types

The compiler supports data types for char, which defaults to signed char. An option can be used to use unsigned char as the default, see Options for Controlling the C Dialect.

It is a common misconception that the C char types are intended purely for ASCII character manipulation. This is not true; indeed, the C language makes no guarantee that the default character representation is even ASCII (however, this implementation does use ASCII as the character representation). The char types are simply the smallest of the multi-bit integer sizes and behave in all respects like integers. The reason for the name “char” is historical and does not mean that char can only be used to represent characters. It is possible to freely mix char values with values of other types in C expressions. With the MPLAB XC16 C Compiler, the char types will commonly be used for a number of purposes: as 8-bit integers, as storage for ASCII characters and for access to I/O locations.