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 the following table lists.

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

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.