I used the debugger to examine this code but not understanding a couple areas.
int main(void)
{
int height = get_int("Height: ");
draw(height);
}
void draw(int n)
{
if (n <= 0)
{
return;
}
draw(n - 1);
for (int i = 0; i < n; i++)
{
printf("#");
}
printf("\n");
}
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.
Hope you enjoy the instance!
Follow the wormhole through a path of communities !webdev@programming.dev
Yes, that helps. Thanks. I see now how n goes from 1 to 2 to 3…etc. Now not so sure how i = 1 when the for loop starts.
When called with n=1 ? It’s from i=0 to i<1, so it will do only one iteration with i=0 and print one #.