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 SEQUENCE USES
\a Alarm or Beep
\b Backspace
\\ Backslash
\r Carriage Return
\” Double Quote
\f Form Feed
\xhh Hexadecimal Number
\n New Line
\0 Null
\nnn Octal Number
\? Question Mark
\’ Single Quote
\t Tab (Horizontal)
\v Vertical 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.
Please follow and like us:
Content Protection by DMCA.com