escape sequences

Home / C Programming / escape sequences

escape sequences


Escape Sequence in C

An escape sequence in C language is a sequence of characters that doesn't represent itself when used inside string literal or character.

It is composed of two or more characters starting with backslash \. For example: \n represents new line.

List of Escape Sequences in C

Escape SequenceMeaning
\aAlarm or Beep
\bBackspace
\nNew Line
\rCarriage Return
\tTab (Horizontal)

Escape Sequence Example

  1. #include<stdio.h>    
  2. int main(){    
  3.      int number=50;  
  4.     printf("You\nare\nlearning\n\'c\' language\n\"Do you know C language\"");     
  5. return 0;  
  6. }     

Output:

You
are
learning
'c' language
"Do you know C language"