For example, when C nested loops, the inner layer of this writing method is only executed once to solve!
#include <stdio.h>
void draw_box(int, int);
int main()
{
draw_box(4, 5);
return 0;
}
void draw_box(int row, int column)
{
for (; row > 0; row--)
{
for (; column > 0; column--)
{
printf("x ");
}
printf("\n");
}
}
In the result, it is obvious that the line feed was output 4 times, but the inner loop was executed only once.
After the execution of the outer loop, the column must be re-assigned, otherwise the column will always be equal to 0 after the first loop, and the execution will not continue.