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 SequenceCharacter It RepresentsASCII Value (decimal)
\aBELL (alert)7
\tHorizontal Tab9
\nNewline (Line Feed)10
\vVertical Tab11
\fForm Feed12
\rCarriage Return13
\"Quotation Mark (Double Quote)34
\'Apostrophe (Single Quote)39
\?Question Mark help63
\\Backslash (\)92
\0NUL (null)0