Linked by Eugenia Loli-Queru on Sat 13th Jan 2007 04:25 UTC
Thread beginning with comment 201453
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.
"I'm afraid you're reading the error message incorrectly, it actually means that the for(int i=0; ... style of declaring values in loops is part of the C99 standard, but cc's default 'C' is not the ISO 1999 C standard."
Oops... call me Mister Stupid. :-) The declarations of variables inside for() is of course possible with ISO C 99 (-std=c99), but not with standard C (K&R), where declarations have to be prior to statement lines.






Member since:
2006-02-28
pp1ex2.c:11: error: 'for' loop initial declaration used outside C99 mode
I'm afraid you're reading the error message incorrectly, it
actually means that the for(int i=0; ... style of declaring values in loops is part of the C99 standard, but cc's default 'C' is not the ISO 1999 C standard.
Try
cc -std=c99 -Wall -o pp1ex2 pp1ex2.c
and the warning messages will disappear.