From: "Robin Y. Millette" Newsgroups: comp.os.msdos.djgpp Subject: Re: Newbie Question (variable dec.) Date: Mon, 15 Feb 1999 10:09:11 GMT Organization: Waglo Institution Lines: 39 Message-ID: <7a8ro3$55g$1@nnrp1.dejanews.com> References: <36c399d2 DOT 18754602 AT news DOT okstate DOT edu> <36C7320E DOT FB4111F9 AT lycosmail DOT com> NNTP-Posting-Host: 204.209.212.80 X-Article-Creation-Date: Mon Feb 15 10:09:11 1999 GMT X-Http-User-Agent: Mozilla/4.0 (compatible; Opera/3.0; Windows 95) 3.51 [en] X-Http-Proxy: 1.0 x14.dejanews.com:80 (Squid/1.1.22) for client 204.209.212.80 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <36C7320E DOT FB4111F9 AT lycosmail DOT com>, djgpp AT delorie DOT com wrote: > 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. > 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 > > what I'm wondering is this just a part of standard C, > > is there some option that will change this? In C++, you can declare variables anywhere in your code, preferably near first use. In C, it must be before any function in that block. Thus, you could have something like this, although I've never seen it in real code, and I'm not sure what the compiler does with it: int main(void) { int x; for (x=0; x<10; ++x) printf("%3d", x); { int y; for (y=0; y<10; ++y) printf("%3d", y); } return 0; } Fastest Computer on Earth needs you! http://www.distributed.net - team 844 -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own