Forum

> > Off Topic > Expected identifier: C problem
Forums overviewOff Topic overviewLog in to reply

English Expected identifier: C problem

2 replies
To the start Previous 1 Next To the start

old Expected identifier: C problem

DannyDeth
User Off Offline

Quote
Hello us,
I have recently found a website named Project Euler, and thought I might try out some of the tests there. So I wrote a little 14 line program in C. I tried compiling the code ( using TCC, C99 standard ) and it says 'expecting identifier', right where my For loop beings. I don't get it because i gave it the same arguments as always:
1
for( int i = 0; i < 333; i++ ) {
Yet it still errors, I cannot see a single thing wrong with that code. Any help/advice is much appreciated.

~DannyDeth
edited 1×, last 18.01.11 04:13:18 pm

old Re: Expected identifier: C problem

Lee
Moderator Off Offline

Quote
c99 disallows inline definition, ie for (int i = 0; ...).

C++ allows this syntax but will produce a warning (the lexical scope of the inlined declarations are at best ambiguous in certain constructs that do not express the full semantic that the programmer is trying to convey)

1
2
int i;
for (i = 0; i < 333; i++) {
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview