by Dinesh Thakur Category: Basic Of C Programming

Escape sequences are basically control characters used for formatting the output. These are combinations of a backslash and a character in lowercase. We have already used "\n", which shifts the curser to the next line. Table lists the escape sequences defined in C language.

  Escape Sequences in C

Illustrates application of some escape characters.

#include <stdio.h>

int main ()
{
   printf("\a Hello!\nHow are you?\n");
   printf("I am learning C.\n");
   printf ("\tAm I physically fit?");
   printf ("\nAm\tI physically" " fit?\n");
   return 0;
}

The output of this program is as given below. Because of code "\a" you will hear a beep sound. Compare the spaces specified in the code with those obtained in the output.

Escape Sequences



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.