So, I finally managed to get my Mario working properly. There was, however, one bug that cost me lot of nerves to find and even thought I removed it successfully, I still don't fully understand why did it occur. Without further ado, here is the loop implemented in my mario.c (where the 'n' is the user-gen input):
for (int a = n; a > 0; a--)
{
int c = a - 1;
for (; c > 0; c--)
{
printf (" ");
}
int b = a - 1;
int d = n - b;
for (; d > 0; d--)
{
printf ("#");
}
printf (" ");
d = n - b;
for (; d > 0; d--)
{
printf ("#");
}
printf ("\n");
}
The thing is, that during my previous attempts instead of
int c = a - 1;
I tried to use the shorter version of
int c = a --;
which kept on breaking down my pyramids in very asymmetrical ways. After listing the values of my integers I eventually found the issue, I still don't however understand why wouldn't the shorter version work in this case. Is this a syntax issue when one just has to type the full formula while defining an integer, or is there another, perhaps more logical solution that I'm just not seeing?
P.s.: My 1st post here and a complete noob in c, so please be gentle.