I've known that
for (...; ...; ...)
printf ("Fulfill the limits.");
and
if (...)
printf ("Fulfill the limits.");
are C standard.
But
for (...; ...; ...)
if (...)
for (...; ...; ...)
if (...)
for (...; ...; ...)
printf ("Fulfill all the limits.");
is compiled successfully, and run without (logic) errors.
Does complicated-nested for/if statement really follow the C standards or just mingw32 compiler-specific?
Thanks.
It is perfectly valid syntax. The syntax is not complicated, simply nested like x1 + (x2 + (x3 + ..)
.
That is, if/for
is a statement and if/for
contains a statement. This can be seen in the recursive BNF grammar rules:
statement:
"if" "(" expression ")" statement |
"for" "(" expression? ";" expression? ";" expression? ")" statement |
..