What is Escape sequence…?
Escape sequence characters
Q) What is the escape sequence? What is its purpose? Explain the meaning of the following?
- b
- r
- f
- n
- C supports a special type of character which is the combination of backslash (/)and another character e.g. it is known as an escape sequence character.
- The is considered an escape character. This causes an escape from some normal interpretation of a string so that the next character means recognized as essentially one having a special meaning.
Following are the escape sequence characters in C with their meanings:
Image Source ~ Crafted With ©Ishwaranand – 2020 ~ Image by ©Ishwaranand |
Character meaning Escape sequence
a – Audible alert (beep)
b – Backspace
n – New line
t  – Horizontal tab
f  – Form feed
r – Carriage return
\Â – Backslash
‘Â – single quote
”  – Double quote
v  – Vertical tab
?  – Question mark
OÂ Â – Null character
- a
It gives an audible beep.
printf(“a”)
- b
This character works as backspace.
 printf (“abcdb”);
 printf (“xyz”);
output:
 abcxyz
- n
It display the new line on screen
printf(“abcdnxyz”);
output:
abcd
xyz
- t
It display the horizontal tab.
 printf(“abcdtxyz”);
output:
abcd xyz
- f
This character works as a form feed.
- r
This character works as a carriage return.
printf(“abcrxyz”);
output:
xyz
Last updated on Sunday - May 21st, 2023