Escape Sequences
Last modified by Microchip on 2023/11/10 10:59
Escape sequences, sometimes called "digraphs", make it possible to include non-printable characters, or characters that by themselves have special meaning into a character or string literal. Although these are all typed in as two characters starting with a backslash (\), they are technically just a single character (a single 8-bit code is represented by them, just like any other character). Below are some of the escape sequences you are most likely to encounter.
Escape Sequence | Character It Represents | ASCII Value (decimal) |
---|---|---|
\a | BELL (alert) | 7 |
\b | Backspace | 8 |
\t | Horizontal Tab | 9 |
\n | Newline (Line Feed) | 10 |
\v | Vertical Tab | 11 |
\f | Form Feed | 12 |
\r | Carriage Return | 13 |
\" | Quotation Mark (Double Quote) | 34 |
\' | Apostrophe (Single Quote) | 39 |
\? | Question Mark | 63 |
\\ | Backslash (\) | 92 |
\0 | NUL (null) | 0 |