Backslash Character Literal / Escape Sequence:
“C Language” supports special backslash character constant that are used in output functions. These character combinations are also known as “Escape Sequences”.
Size of these characters is one byte.
Constant | Meaning |
‘\a’ | Alert bell |
‘\b’ | BackSpace |
‘\f’ | Form feed |
‘\n’ | Newline character |
‘\r’ | Carriage Return(Run time Enter) |
‘\t’ | Horizontal Tab |
‘\v’ | Vertical tab |
‘\”‘ | Double quote |
‘\’’ | Single quote |
‘\0’ | NULL (Terminating character of a character array/string) |
‘\a’ : Alert Bell (A bell sound will come along with the output )
#include<stdio.h> int main() { printf("Hello\a"); return(0); }
Output:
Hello
‘\b’ back space, On using this cursor move one character back
#include<stdio.h> int main() { printf("Hello\bHi"); return(0); }
Output:
HellHi
#include<stdio.h> int main() { printf("Hello\b\bHi"); return(0); }
HelHi