Escape Sequences

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
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.