C Language Escape Sequences - dummies

C Language Escape Sequences

By Dan Gookin

Part of C For Dummies Cheat Sheet

Programming in C is fast — all you have to do is type a short sequence of keystrokes — generally just two — to get a tab, a new line, a question mark, and more. The following table shows the sequences you need to accomplish a variety of tasks:

Sequence Represents
a The speaker beeping
b Backspace (move the cursor back, no erase)
f Form feed (eject printer page; ankh character on the
n Newline, like pressing the Enter key
r Carriage return (moves the cursor to the beginning of the
t Tab
v Vertical tab (moves the cursor down a line)
\ The backslash character
The apostrophe
The double-quote character
? The question mark
The “null” byte (backslash-zero)
xnnn A character value in hexadecimal (base 16)
Xnnn A character value in hexadecimal (base 16)