Character Constants

Enclose a character constant in single quotes. However, if the character constant includes a single quote, use double quotes to enclose the character constant.

Note: A character constant cannot include both single and double quotes.

The maximum width of a character constant is 4 characters, depending on the context. Examples are 'A', 'ABC', and 'TEXT'.

A character constant can contain any of the escape sequences that Character Constant Escape Sequences lists.

Table 1. Character Constant Escape Sequences
Sequence Description
\b Backspace
\n Line feed (ASCII character 10)
\r Return (ASCII character 13)
\t Tab
\" Double quote
\\ Backslash
\nnn Octal value of \nnn

During computation, the assembler zero-extends a character constant to 32 bits. You can use a character constant anywhere you can use an integer constant.