Variable declaration on "start value" of FOR loop - What C standards allow it? -
c language
on c standard following code compiles without error (c89, c99, c11)
for (int = 0; < 10; ++i) { something... }
i understand c compilers won't accept version above , variable "i" must declare outside parentheses. so:
int i; (i = 0; < 10; ++i) { something... }
this allowed since c99. c99 , c11 support it.
in c89, first clause of for
statement can expression. in c99 , c11 can expression or declaration. 1 single declaration allowed (though can declare several variables).
Comments
Post a Comment