Your programs will often need to keep track of characters, either as keys which have just been read from a keyboard, or as letters to display. C provides a special data type just for this. Variables of this type are declared using the keyword char:

/* ch is a character variable */
char ch ;

The char character type can be used just as the integer type, but it is only held in 8 bits. This limits the range of possible values to 0 - 255, but it greatly reduces the amount of space needed to hold the value.

As far as the PICmicro is concerned an 8 bit item (often called a byte) is the standard size of its storage, and so you should use the char data type as often as possible. Later we will see how to put actual character codes into our character variables.

The CPIC on the right shows how two variables of different types are declared. count is an integer and ch is a character variable.