Re: Error: 'for' loop initial declaration used outside c99 mode
- From: "Pedro Pinto" <kubic62@xxxxxxxxx>
- Date: 3 Nov 2006 00:53:24 -0800
james of tucson escreveu:
Pedro Pinto wrote:
When compiling my program i got this error:
Error: 'for' loop initial declaration used outside c99 mode
What is it and how can i solve it?
You're coming to C from a Java background, aren't you?
This is illegal in most C dialects; it is a legal C++ declaration, and
so may be accepted if you are compiling C with a C++ compiler:
for( int k=0; k<10; k++){}
I do like that syntax since it's such a common idiom to have a loop
iterator only in the scope of the loop.
Hi again!
Yes, the issue was that i was declaring the int i inside the for! =)
And yes, i first started programming in Java, thus my dificulties in
understanding certain apects of C! Thanks a million
.
- References:
- Error: 'for' loop initial declaration used outside c99 mode
- From: Pedro Pinto
- Re: Error: 'for' loop initial declaration used outside c99 mode
- From: james of tucson
- Error: 'for' loop initial declaration used outside c99 mode
- Prev by Date: Cannot return values of char variable
- Next by Date: Re: Cannot return values of char variable
- Previous by thread: Re: Error: 'for' loop initial declaration used outside c99 mode
- Next by thread: Re: Error: 'for' loop initial declaration used outside c99 mode
- Index(es):
Relevant Pages
|
|