What is Escape sequence...? - Ishwaranand

News

What is Escape sequence...?

Escape sequence characters

Q) What is the escape sequence? What is its purpose? Explain the meaning of the following?

  1. \b
  2. \r
  3. \f 
  4. \n
  • C supports a special type of character which is the combination of backslash (/)and another character e.g. in is known as escape sequence character.
  • The \ is considered as an escape character. This causes an escape from some normal interpretation about a string so that the next character means recognized essentially one having a special meaning.

Following are the escape sequence characters in C with their meanings:

what is escape sequence in python, escape sequence in java, escape sequence in c, escape sequence example, escape sequence in c tutorialspoint, escape sequences are prefixed with, which of the following is an escape sequence mcq, what are escape sequences explain with example, escape sequence in c#, escaping computer science, escape sequence in python, escape sequence in java, escape character java, line feed escape sequence, escape sequences java, escape sequences python, escape sequence javascript, escape sequence in unix, escape sequence in php, c language is of which level language, escape sequences are prefixed with, special symbols in c, escape sequence in c, c++ special characters in strings,
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 ("abcd\b");
  printf ("xyz");
output:
  abcxyz
  • \n
It display the new line on screen
printf("abcd\nxyz");
output:
abcd
xyz
  • \t
It display the horizontal tab.
 printf("abcd\txyz");
output:
abcd  xyz
  • \f
This character works as a form feed.
  • \r
This character works as a carriage return.
printf("abc\rxyz");
output:
xyz

No comments

Comment on Ishwaranand or Happy Day
Not, Add any types of links