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.
Illustrates application of some escape characters.
1 2 3 4 5 6 7 8 | #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.