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 - 3. Bits & Bytes

Bits Bits means the measurement of computer memory where we can store binary number or word. N-bits memory can store n-bits binary number or words for example :          1-bit memory can store either  1 or 0 because 1 and 0 are 1-bit binary numbers          2-bit memory can store:                                                   00                                                   01                   ...

C Programming - 4.5 The printf() function

We have been talking about this guy for so long and he finally came And you will see him most of the time whenever you write a C code. So, What printf() function do? It basically prints everything within the double quotation . for example: printf("I am a programmer"); this prints:                     I am a Programmer In full code that will be- #include <stdio.h> int main() {      printf("I am a Programmer");      return 0; } Now, see another code  #include <stdio.h> int main() {      printf("I am a Programmer");      printf("I am a Programmer");      return 0; } the output will be:          I am a ProgrammerI am a Programmer The output is like this because we haven't use newline character to indicate the en...

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