C Programming Escape Sequences

Escape sequences are special characters that are used to represent certain non-printable characters such as newline, tab, or backspace. In C, escape sequences are represented by a backslash \ followed by a specific character or sequence of characters.

Here is a list of the most commonly used escape sequences in C:

Escape SequencesCharacter
\bBackspace
\fForm feed
\nNewline
\rReturn
\tHorizontal tab
\vVertical tab
\Backslash
'Single quotation mark
"Double quotation mark
?Question mark
\0Null character

Double quote

Using Escape Sequences: Escape sequences are used in C programs to represent special characters that are not printable or have a special meaning. For example, to output a newline character, the syntax would be:

1printf("This is line 1.\nThis is line 2.");

Output:

1This is line 1. 2This is line 2.