Skip to main content

Posts

Featured

Simple thing but important thing we should know in C programming

 Simple things but important things we should know in C programming We will discuss: the usage of tab key and spaces in C First look at these examples:   Example 1 To check ex ample 1 Example 2 To check example 2 You can see here, I got two outputs using tab and spaces. In the first example, I used spaces. Second example I used tabs.1st example C code is much more complex than 2nd example code. why? The reason for that is when I use spaces, I have to count the spaces to get the right answer. but in the second example no need to do that to get the right answer. Now, understand what is the difference: First example: To check ex ample 1 for(k=1; k<=n-i; k++){  printf("    ");           //  4 spaces  } Now, check out how many spaces will be put on the output by for loop : Row 1; If n=7,  i=1 then n-i=7-1=6. so, this loop will run 6 times. then all the spaces it will put in the output = 6 * 4= 24 spaces. So, what happen...

Latest posts

C Sample programs with explanation

Build a Simple Calculator, Build a Guessing Game, Build a Mad Libs Game using C