Code:
int main()
{
int n;
int i;
for (n=1; n<=5; n++)
{
for (i=0; i<n; i++) // when the code reaches this loop and prints "*" i; will be +1 i.e i=1; and eventually i; will equal to n; and the code will jump out of the loop. What I dont understand is why i; resets after jumping out of the loop. When the loop starts again, i; equals to 0 instead of being 1 smaller than n;
{
printf("*");
}
printf("\n");
}
return0;
}
Im not trying to achieve a different result. I just need to know why i; goes back to 0 after jumping out of the loop.