# escape sequence in C

In order to design your output on the console window or to make the output more readable in the c programming language, you should use an escape sequence in C.

An escape sequence in C language is a sequence of characters that doesn’t represent itself when used inside string literal or character. It is composed of two or more characters starting with backslash \.

Escape Sequence Meaning
\a Alarm or Beep
\b Backspace
\f Form Feed
\n New Line
\r Carriage Return
\t Tab (Horizontal)
\v Vertical Tab
\\ Backslash
\’ Single Quote
\” Double Quote
\? Question Mark
\nnn octal number
\0 Null

I will be going through each escape sequence in C one by one.

An alert escape sequence is written by a combination of a backslash followed by a ( \a ). This is also called as an alarm or beep escape sequence because it produces an audible alert.

Whenever you will use the alert escape sequence, you will listen a beep.

### Backspace Escape Sequence

The backspace escape sequence is written by a combination of a backslash followed by b ( \b ). Whenever you will use the backspace escape sequence in C, it will move the cursor by one step back in destructive mode. You can say that it moves the cursor back to one position.

### Form Feed Escape Sequence

Form feed escape sequence is written by a combination of a backslash followed by f ( \f ). Whenever form feed escape sequence is used it moves the cursor to the first position of next page.

### New Line Escape Sequence

New Line escape sequence is written by a combination of a backslash followed by n ( \n ). The function of the new line escape sequence is to move the cursor to the first position of the next line.

### Carriage Return Escape Sequence

Carriage Return escape sequence in C is written by a combination of a backslash followed by r ( \r ). The function of carriage return escape sequence in C is to move the cursor to the first position of the current line.

### Horizontal Tab Escape Sequence

The horizontal tab escape sequence is written by a combination of a backslash followed by t ( \t ). The function of the horizontal tab escape sequence in C is to move the cursor to the next horizontal tabular position.

### Vertical Tab Escape Sequence

Vertical tab escape sequence in C is written by a combination of a backslash followed by v ( \v ). The function of the vertical tab escape sequence in C is to move the cursor to the next vertical tabular position.

### Backslash Escape Sequence

A backslash escape sequence is written by a combination of a backslash followed by \ ( \\ ). The function of this escape sequence in C is to produce a single backslash.

### Single Quote Escape Sequence

Single quote escape sequence in C is written by a combination of a backslash followed by ‘ ( \’ ). The function of this escape sequence in C is to produce a single quote.

### Double Quote Escape Sequence

The double quote escape sequence is written by a combination of a backslash followed by ” ( \” ). The function of this escape sequence in C is to produce a double quote.

### Question Mark Escape Sequence

Question mark escape sequence in C is written by a combination of a backslash followed by? ( \? ).

### Octal Number Escape Sequence

Octal number escape sequence in C is written by a combination of a backslash followed by nnn ( \nnn ).

The hexadecimal escape sequence is written by a combination of a backslash followed by xhh ( \xhh ).

### Null Escape Sequence

A null escape sequence is written by a combination of a backslash followed by 0 ( \0 ). It produces a null character.