A character constant is a character enclosed in single quotes,
as in 'x'.
The value of a character constant is the numerical value of the character
in the machine's character set, for example:
'A' | valid (value is 65 for the ASCII character set) |
'AB' | invalid (more than one character) |
Certain special characters, such as the single quote '
and the backslash \, may be represented according
to the following table of escape sequences:
| newline | NL(LF) | '\n' |
| horizontal tab | HT | '\t' |
| backspace | BS | '\b' |
| carriage return | CR | '\r' |
| form feed | FF | '\f' |
| backslash | \ | '\\' |
| single quote | ' | '\'' |
| double quote | " | '\"' |
| null | NUL | '\0' |
| bit pattern | ddd | '\ddd' |
The escape \ddd
consists of the backslash followed by a stream of octal
digits which are taken to specify the value of the desired character.
If the character following a backslash is not one of those specified,
the backslash is ignored.