title: Diamond Shape Output With `for` Loops
body: <p>The program is simply to create the shape of a diamond when the user input the number of rows so simply it has 6 for loops; 3 loops to create the first triangle and 3 loops to create the other triangle, and with these 2 triangles and 6 loops we have a diamond,this is an image of the whole program:</p>
  
  <p><img src="https://i.stack.imgur.com/rHUkU.png" alt="Image"></p>
  
  <p>I'm a little confused about the 5th for loop, the one that creates the spaces for the second triangle, the loop begins by adding 1st space then the loop ends, the program continues to the 6th loop and get back to the 4th loop to do the 5th &amp; 6th loops all over, the 5 loops is adding 1,2,3,.. spaces ever time and we can see that from: <code>spaces++</code>, the problem is how is this working? the counter c is also getting higher every time, <code>c++</code>, so the difference between(space and c) will still be 1 every time so it suppose to be adding only one space every time, for those who understood what I was saying can you explain this too me</p>
  
  <pre><code>int n, c, k, space = 1;
  
    printf("Enter number of rows\n");
    scanf("%d", &amp;n);
  
    space = n - 1;
  
    for (k = 1; k &lt;= n; k++)
    {
      for (c = 1; c &lt;= space; c++)
        printf(" ");
  
      space--;
  
      for (c = 1; c &lt;= 2*k-1; c++)
        printf("*");
  
      printf("\n");
    }
  
    space = 1;
  
    for (k = 1; k &lt;= n - 1; k++)
    {
      for (c = 1; c &lt;= space; c++)
        printf(" ");
  
     space++;
  
      for (c = 1 ; c &lt;= 2*(n-k)-1; c++)
        printf("*");
  
      printf("\n");
    }
  </code></pre>