Skip to main content

C Programming - 4.4 Escape Sequence

What? 

Escape Sequence !!!

Yeah, you heard that right

There are some characters in C, which breaks the sequence of characters for formatting the output of a program, that's why these characters are called escape sequence.

Most used escape sequences are


        /n - this is also called newline character

        /t - you can call it TAB character


Yeah, you guess that right, the '\n' - newline character prints a newline when it is within double quotation("") of printf() function.

Look at the top-left corner of your computer keyboard, you will find a button called TAB.

Now, open an editor
         start editing a file

When you press TAB, it inserts 8 spaces by default. In some editors, you can modify the TAB size like Sublime Text, Code-Blocks etc.

for my case, I am using 4 space TAB.

So, in the editor, it depends upon your choice

But, in C program output  '\t' - TAB character prints 8 spaces when it is within double quotation("") of printf() function.

TAB vs. Spaces


there is an interesting story about TAB vs. Spaces 💣 in

Silicon Valley Season 3  Episode 6 💣💥

hope you like it


Happy Coding
See you in the next tutorial



Next Post:


https://coderavens.blogspot.com/2018/05/c-programming-45-printf-function.html

Comments

Popular posts from this blog

C Programming - 4.1 First C program

First C program #include <stdio.h> int main() {      printf("I am a Programmer\n");      return 0; } Output:                    I am a Programmer In the next tutorials, we will understand this code point by point. Semicolon Issue we have to remember one important thing always end of every statement in C we have to put a semicolon From the first code, there are two statements        printf("I am a Programmer\n");        return 0; and both of them have a semicolon at the end of the line or statement Some people find this annoying 😒 but like it or  not we have to be careful about this Happy Coding See you in next tutorial Next Post: https://coderavens.blogspot.com/2018/05/c-programming-42-main-function.html

C Programming - 4.3 Header Files

Now, again see the first C program I wrote #include <stdio.h> int main() {      printf("I am a Programmer\n");      return 0; } Now, what #include <stdio.h> means actually  Here, stdio.h known as a Header file 😮, remember it's not studio.h 😜 . So many persons done that mistake when he/she first write C codes And, the coolest thing about header file is, it will give you a headache 😨 OK, I am just kidding  Header file term refers to that kind of file which contains C function declarations and macro definitions. A C header file contains .h extension. Like in this code stdio.h contains function declaration and definition of printf() that's why we had to include the  stdio.h  header file at the top of the code The basic syntax of including header files on top of the code #include <header_file_name> Now, you can wonder about printf() function, don't worry we will learn it gradually Some frequently used

C Programming - 1. Intro

Hi Everyone, In this series, we will be learning C Programming. So, What is Programming actually? Programming is the most amazing thing in this modern era. Programming is the way to teach the dummy computer what to do because a computer only understands 1's and 0's nothing else. And the combination of a 1's and 0's make a binary number, we all know that. Example: 1001000 1000101 1001100 1001100 1001111 Now, what this binary code says? It says "HELLO" 😮. It's cool right. One day I will teach you how to do this, then you can encoded cool messages or you can use it to propose someone 😉. Anyway, Now you can wonder what the heck is that I can play games like Far Cry 4 or Witcher 3 that seems pretty Advanced. OK, thanks to those programmers who find a way to do all those great things by the dummy computer. But, remember not only the games, think about your Android or iOS device, how cool is that. And the social networ