An escape sequence is a sequence of character that used inside the string literal or character. All the escape sequence is used with the backslash (
\) symbol.
The list of an Escape sequence is as follows:
| 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 |
| \xhh |
hexadecimal number |
| \0 |
Null |
Let us consider an Example
#include <stdio.h>
int main()
{
int number=50;
printf("Hello friends,\nWe are Learning C Language Tutorial
\nfrom Tutorialandexample.com");
return 0;
}
Output
Hello friends,
We are Learning C Language Tutorial
from Tutorialandexample.com