Escape characters 🏃in c

What are Escape Characters in C ?

  • Escape Sequences in C are use to represent other characters, which generally are not present in ASCII Characters, and are hard or impossible to represent without using Escape Characters. Escape Characters are usually followed by a ‘backslash‘ and one or more ‘character‘, for example-: \n, \t, etc. 

  • Like every other programming languages, C programming language also has a predefined set of characters, which a programmer can use while coding in C. There are a total of 256 characters in C Language, which are further divided into two categories

  • ASCII Characters
Extended ASCII Characters
Other than these 256 characters, there are some other special characters also present in C, which do not represent themselves, they are categorized as Escape Characters or Escape Sequences in C Programming Language
Escape chr _Use for _Hex value in ASCII
          \a.   Alert(Beep Sound) 07
          \b.     Backspace 08
          \e.  Escape Character 1B
          \f       Formfeed Page break 0C
          \n.  New line 0A
          \r.     Carriage return 0D
          \t    Horizontal Tab 09
          \v.    Vertical Tab 0B
         \\.     Backslash 5C
          \’   Apostrophe 27
         \”  Double quotes 22
         \?     Question mark 3F
        \nnn  Octal number any
        \xhh  Hexadecimal number any
       \uhhhh  unicode point below 10,000                                       hexadecimal none
   \uhhhhhhhh  unicode point where h is a hexadecimal
Posted on by