Escape Sequences in C

Escape Sequences in C

Hello everyone, Welcome back to Think & Free. This is the fifth episode of our Express Learning Programming lesson series and today I’m going to talk about How to Use Escape sequences in C. In this series, I will show you how to start programming, step-by-step with the GNU C Programming language. Here are our previous lessons.

Previous Lessons

If you are new to Programming, read our previous lessons before reading this lesson. In this lesson, I will show you what the Escape Sequences mean in C, How escape sequences work, and everything you must know. Okay, Let’s dive into today’s lesson.

Escape Sequences

It is a sequence of characters, They are Configured to other characters or string literal. It can translate into some character. Characters may be difficult or impossible to represent directly.

\aAlarm or Beep
\bBackspace
\fForm Feed
\nNew Line
\rCarriage return
\tTab (Horizontal)
\vTab (Vertical)
\\Backslash
\’Single Quote
\”Double Quote
\?Question Mark
\oooOctal Number
\xhhHexadecimal Number
\0Null

Let’s see some examples, Here is some example of escape sequences in C.

#include 
int main()
{
    printf("Hello\nWorld\n");
    printf("\tHello, World\n");
    printf("This is \\ backslash");
    return 0;
}

Open up your favorite text editor and write down these codes, Now save your project and compile it. Once the compilation process has been completed, run the compiled executable file.

I think that’s enough for this quick lesson about Escape sequences. Try yourself, and leave a comment if you have a question.

CATEGORIES
TAGS
Share This

COMMENTS

Wordpress (0)
Disqus (6 )