Escape Sequence in C | What is the Escape Character?.

Escape Sequence Characters List

List all the escape sequence characters in C Language. In ASCII table total numbers of character are 256 which divided into total 3 parts, Printable, Non-printable, and Extended. If we talk about ASCII 7-bits there are a total of 128 characters, in which 95 are printable and 33 are not printable. So if Escape character is not a part of ASCII table then the question is what are Escape Sequence.

What is the Escape Sequence?

An escape sequence is a sequence of characters that helps to convert some other characters(or escape sequence does not represent itself). for example, it’s impossible to print the newline so we use escape sequences to print newline by using backslash “\” and character “n” together “\n“.

What is the Escape Character?

We cannot print a newline directly in any programming language(C, C++, Java, and C#) by just hitting the enter key. So here backslash is called “escape character“.

Use of escape character and some other characters combination, we use to print some impossible characters. In c, all escape sequences consist of two or more characters it a combination of backslash and characters.

List all the Escape Sequence Characters in C

Escape SequenceMeaningExplanation
\aAlarm or BeepA beep sound is generated
\fForm FeedForm Feed page break(Return)
\nNew LineShift the cursor control to the new line
\rCarriage ReturnShift the cursor to the beginning of the current line
\tTab (Horizontal)Shift the cursor to a couple of spaces(Eight blank spaces) to the right in the same line
\vVertical TabVertical Tab
\\BackslashPrint the backslash character
\’Single QuoteDisplay the single-quotation mark.
\”Double QuotePrint the double-quotation mark
\?Question MarkDisplay the question mark
\nnnoctal numberRepresent an octal number
\xhhhexadecimal numberRepresent a hexadecimal number
\0NullTermination of the string


Please enter your comment!
Please enter your name here