Previous Section
TOC
| Table of Contents | Index | Next Section
1.2 Identifiers

1.1.1 Trigraph Characters

A trigraph sequence found in the source code is converted to its respective translation character. This allows people to enter certain characters that are not allowed under some (rare) platforms.

Trigraph Sequence Translation Character
??= #
??( [
??/ \
??) ]
??' ^
??< {
??! |
??> }
??- ~
Example:
printf("No???/n");
translates into:
printf("No?\n");

1.1.2 Escape sequences

The following escape sequences allow special characters to be put into the source code.

Escape Sequence Name Meaning
\a Alert Produces an audible or visible alert.
\b Backspace Moves the cursor back one position (non-destructive).
\f Form Feed Moves the cursor to the first position of the next page.
\n New Line Moves the cursor to the first position of the next line.
\r Carriage Return Moves the cursor to the first position of the current line.
\t Horizontal Tab Moves the cursor to the next horizontal tabular position.
\v Vertical Tab Moves the cursor to the next vertical tabular position.
\' Produces a single quote.
\" Produces a double quote.
\? Produces a question mark.
\\ Produces a single backslash.
\0 Produces a null character.
\ddd Defines one character by the octal digits (base-8 number). Multiple characters may be defined in the same escape sequence, but the value is implementation-specific (see examples).
\xdd Defines one character by the hexadecimal digit (base-16 number).
Examples:
printf("\12");
Produces the decimal character 10 (x0A Hex).

printf("\xFF");
Produces the decimal character -1 or 255 (depending on sign).

printf("\x123");
Produces a single character (value is undefined). May cause errors.

printf("\0222");
Produces two characters whose values are implementation-specific.

1.1.3 Comments

Comments in the source code are ignored by the compiler. They are encapsulated starting with /* and ending with */. According to the ANSI standard, nested comments are not allowed, although some implementations allow it.

Single line comments are becoming more common, although not defined in the ANSI standard. Single line comments begin with // and are automatically terminated at the end of the current line.


Previous Section
TOC
| Table of Contents | Index | Next Section
1.2 Identifiers