Message-ID: <36C7320E.FB4111F9@lycosmail.com> Date: Sun, 14 Feb 1999 15:29:02 -0500 From: Adam Schrotenboer X-Mailer: Mozilla 4.5 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: Newbie Question (variable dec.) References: <36c399d2 DOT 18754602 AT news DOT okstate DOT edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com I don't know why this happens, but I do have to say that I do that kind of thing often (in C++ mind you). Q, do you have optimizations on?? That _might_ to it. (Certain loop optimizations are somewhat untested, such as loop-unrolling) Also, in this case (though w/ gcc it may be somewhat irrelevant) you could write it as: for(int x=0;x<=10;x++) printf("%i\n,x). This makes x local to the loop, and unusable(out of scope) anywhere else. Carl Marg wrote: > I'm using DJGPP, and I've noticed that it will not allow me to > declare variable in the middle of code, i.e > > int x,y; > for (x=0;x<=10;x++) printf("%i\n",x); > for (y=0;y<=10;y++) printf("%i\n",y); > > the code above would work, while below it would give me a parse error > > int x; > for (x=0;x<=10;x++) printf("%i\n",x); > int y; > for (y=0;y<=10;y++) printf("%i\n",y); > > what I'm wondering is this just a part of standard C, > is there some option that will change this? > > Carl Marg