C Escape Sequence

A sequence of characters starting with backslash ( \ ) that performs a specified function, which is already defined by C, is called as an escape sequence in C. It is named so as it doesn’t represent itself as a character, when it is used inside a string.

Some of the C Escape Sequence are listed below.

ESCAPE SEQUENCEUSES
\aAlarm or Beep
\bBackspace
\\Backslash
\rCarriage Return
\”Double Quote
\fForm Feed
\xhhHexadecimal Number
\nNew Line
\0Null
\nnnOctal Number
\?Question Mark
\’Single Quote
\tTab (Horizontal)
\vVertical Tab

 

Example:

#include <stdio.h>
 
void main()
{
printf ("\tI love my INDIA.\vINDIA is my Country.\nMy Country is my Identity.");
}

Output

I love my INDIA.                                                                                                             
                        INDIA is my Country.                                                                                         
My Country is my Identity.
Content Protection by DMCA.com
Please Share