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 \. For example: \n represents new line.
An escape sequence is a sequence of characters that does not represent itself when used inside a character or string literal, but is translated into another character or a sequence of characters that may be difficult or impossible to represent directly.
List of Escape Sequences in C
Escape Sequence |
Meaning |
\a |
Alarm or Beep |
\b |
Backspace |
\f |
Form Feed |
\xhh |
hexadecimal number |
\nnn |
octal number |
\? |
Question Mark |
\" |
Double Quote |
\' |
Single Quote |
\n |
New Line |
\r |
Carriage Return |
\v |
Vertical Tab |
\t |
Tab (Horizontal) |
Escape Sequence Example:
#include<stdio.h>
int main(){
int num=50;
printf("You\are\nlearning\n Escape sequences \n\in \'c\'Programming"\"");
return 0;
}