Escape sequences in C

Hello everyone, Welcome back to Think & Free. This is the fifth episode of our Express Learning Programming lesson series & 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.

If you are new to Programming, read our previous lessons. What I’m going to show today? In this lesson, I will show you Escape Sequences in C, How it works, and everything you must be known. Ok, Let’s dive into today’s lesson.

Escape Sequences

It is a sequence of characters, They Configured to other character or string literal. It can translate into some character. That 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 to 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, leave a comment if you had a question.

1 thought on “Express Learning – Escape Sequences in C

Leave a Reply

Your email address will not be published. Required fields are marked *