Escape Sequences in C Language

Escape sequences in C are special characters used to represent non-printable or special characters within strings and character literals. They are denoted by a backslash \ followed by a specific character. In this tutorial, we will explore the commonly used escape sequences in C and their corresponding representations.

Here is a table of some common Escape Sequences used in C language:

Escape SequenceDescriptionRepresentation
\\Backslash\
\'Single quote (apostrophe)'
\"Double quote"
\nNewline character(newline)
\tHorizontal tab(tab)
\rCarriage return(return)
\bBackspace(backspace)
\fForm feed (page break)(form feed)
\vVertical tab(vertical tab)
\aAlert (bell)(alert)
\0Null character(null)

Here is an example program that demonstrates the use of new lines and escape sequences in C language:

Output: