When we use output function like printf() than escape sequences helps in formatting the output.
Escape Sequence | ASCII Value | Description |
---|---|---|
\a | 007 | Alert or Beep |
\b | 008 | Backspace |
\n | 010 | New line |
\r | 013 | Carriage Return |
\t | 009 | Tab (Horizontal) |
\? | 063 | Question Mark |
\' | 039 | Single Quote |
\" | 034 | Double Quote |
\\ | 092 | Backslash |
%x | Hexadecimal Number |
Example 1: Escape Sequence
void main() { clrscr(); printf("You\nare\nlearning\n\'c\' - \"language\""); getch(); }
Example 2: Escape Sequence
void main() { clrscr(); printf("A\nB\n"); //new line printf("A\tB\n"); //tab printf("\'ABC\'\n"); //single quotes printf("\"ABC\"\n"); //double quotes printf("\nHow are you\?"); //Question Mark printf("\nFile path is c:\\new folder\\file.ext"); printf("\n%x",100); //64 getch(); }