Escape Sequence in C

Escape Sequence in C Programming is used to format the output. The general and most commonly used escape character is \n (to generate a Newline).

The list of available escape sequences in the C Programming language.

Escape SequencesOperation
\aAlarm or Beep
\bBackspace
\fForm Feed
\nNew Line
\rCarriage Return
\tHorizontal Tab
\vVertical Tab
\\Backslash
\’Single Quote
\”Double Quotes
\?Question Mark
\nnnOctal Number
\xhhHexadecimal Number
\0NULL

Escape Sequence Example

In this program, we are using some of the escape sequence characters inside the printf statement. By this, we can show their functionality, and how to use them in C Programming.

/* Escape Sequence in C */

#include<stdio.h>

int main()
{
    // Horizontal Tab
    printf("Tutorial\tGateway \n");
    //New Line
    printf("Welcome To \nTutorial Gateway \n");
    // Single Quote, and Question Mark
    printf("Learn \'C\' Programming\? \v Visit Tutorial Gateway \n");
    // Vertical Tab
    printf("\v");
    // Double Quotes
    printf("\"Tutorial Gateway\" ");
    // Carriage Return
    printf("\r");
    return 0;
}
Escape Sequence in C