Re: Error: 'for' loop initial declaration used outside c99 mode
- From: james of tucson <jmcgill@[go_ahead_and_spam_me].arizona.edu>
- Date: Thu, 02 Nov 2006 23:31:37 -0700
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.
.
- Follow-Ups:
- Re: Error: 'for' loop initial declaration used outside c99 mode
- From: Richard Bos
- Re: Error: 'for' loop initial declaration used outside c99 mode
- From: Pedro Pinto
- Re: Error: 'for' loop initial declaration used outside c99 mode
- References:
- Error: 'for' loop initial declaration used outside c99 mode
- From: Pedro Pinto
- Error: 'for' loop initial declaration used outside c99 mode
- Prev by Date: Re: character byte str[i] treated as signed, I need unsigned
- Next by Date: [RFC] Double-dabble implementation (was Re: Long Num speed)
- 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
|
|