HP C A.06.05 Reference Manual
Program Organization
Constants
Chapter 2 27
Character Constants
A character constant is any printable character or legal escape sequence enclosed in single
quotes. A character constant can begin with the letter L to indicate that it is a wide character
constant; this notation is ordinarily used for characters in an extended character set. In HP C,
an ordinary character constant occupies one byte of storage; a wide character constant
occupies the rightmost byte of a 4-byte integer.
The value of a character constant is the integer ISO Latin-1 value of the character. For
example, the value of the constant x is 120.
Escape Sequences
HP C supports several escape sequences:
The escape sequences for octal and hexadecimal numbers are commonly used to represent
characters. For example, if ISO Latin-1 representations are being used, the letter a may be
written as \141 or \x61 and Z as \132 or \x5A. This syntax is most frequently used to
Table 2-6 Character Escape Codes
Escape
Code Character What it Does
\a Audible alert Rings the terminal's bell.
\b Backspace Moves the cursor back one space.
\f Form feed Moves the cursor to the next
logical page.
\n Newline Prints a newline.
\r Carriage return Prints a carriage return.
\t Horizontal tab Prints a horizontal tab.
\v Vertical tab Prints a vertical tab.
\\ Backslash Prints a backslash.
\? Question mark Prints a question mark.
\’ Single quote Prints a single quote.
\" Double quote Prints a double quote.