C - Escape Sequences in printf()


You can include whitespace characters in the format control string.

Whitespace characters are the newline, carriage return, form-feed, space, and tab.

Some of these are represented by escape sequences and these are shown in the following table.

Escape sequenceDescription
\b Backspace
\f Form-feed or page eject
\n Newline
\r Carriage return (for printers) or move to the beginning of the current line for output to the screen
\t Horizontal tab

You use the escape sequence \\ to output the backslash character, \.

To write a % character to stdout, you use %%.