Escape Sequence in C Language With Examples

In this series of C language, Today we are going to learn in detail about what is Escape Sequence in C and What is the use of Escape Sequence in C languages.

So let’s learn about Escape Sequence in C languages.

What is Escape Sequence in C Language 

There is some set of characters in C language which we call Character Set or ASCII Code. There is a total of 256 Characters Character Set in C language. The entire Character Set is divided into two parts which are ASCII Character Set and Standard ASCII Character Set. But apart from all this, there are some characters that do not fall into any character set, these are called Escape Sequence.

What is the Meaning of Escape Sequence in C

When we want to start or print a statement from a new line in C language, then we cannot do it just by pressing the Direct Enter key. We need to use Escape Sequence

Let’s understand this with a program.

#include <stdio.h>
int main ()
printf ("Welcome To");
printf ("CsTutorialpoint");
return (0);

Output -:

Welcome To CsTutorialpoint

In this program, I wanted to print CsTutorialpoint from a new line so I tried to print CsTutorialpoint by writing printf () separately, but CsTutorialpoint did not print from a new line.

Now we print the same line of CsTutorialpoint using Escape Sequence.

#include <stdio.h>
int main ()
 printf ("Welcome To \n CsTutorialpoint");
 return (0);

Output -:

Welcome To

In this program, I wrote Welcome To CsTutorialpoint inside the same printf () and used the “\n” Escape Sequence between Welcome To and CsTutorialpoint, and when I compiled and ran the program, “Welcome To” printed a different line. And “CsTutorialpoint” printed from a different line, 

while in the earlier program I wrote both inside different printf (), yet both were printed together in the same line, so obviously using “\n” Escape Sequence We can print a statement in a new line.

By now you have understood that what is Escape Sequence, now let’s learn what is Escape Character?

What is Escape Character

Like I just told by a program in the back that we cannot print the new line by pressing the direct enter key, for that an escape sequence like \n is used, out of this we use the backslash (\) as the “Escape Character”. so backslash (\)  is said to be an Escape character. 

Escape Sequence consists of a combination of backslash and character. Some important tasks are done in the C language using the Escape character and some other characters.

List of Escape Sequences in C Language

Escape SequenceMeaning
\aAlarm or Beep
\fForm Feed
\nNew Line
\rCarriage Return
\tTab (Horizontal)
\vVertical Tab
\’Single Quote
\”Double Quote
\?Question Mark
\nnnoctal number
\xhhhexadecimal number
List of Escape Sequences in C



Friends, I hope that you have found the answer of your question and you will not have to search about the Escape Sequence in C Language 

However, if you want any information related to this post or related to programming language, computer science, then comment below I will clear your all doubts.

If you want a complete tutorial of C language, then see here C Language Tutorial. Here you will get all the topics of C Programming Tutorial step by step.

Friends, if you liked this post, then definitely share this post with your friends so that they can get information about the  Escape Sequence in C Language

To get the information related to Programming Language, Coding, C, C ++, subscribe to our website newsletter. So that you will get information about our upcoming new posts soon.

Jeetu Sahu is A Web Developer | Computer Engineer | Passionate about Coding, Competitive Programming, and Blogging

Leave a Comment

Ads Blocker Image Powered by Code Help Pro
Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
CHP Adblock Detector Plugin | Codehelppro