Date: Tue, 8 Jul 1997 12:54:58 -0400 (EDT) From: "Art S. Kagel" To: George Foot Cc: djgpp AT delorie DOT com Subject: Re: why is this giveing me a parse error? In-Reply-To: <5pjtjp$e36@news.ox.ac.uk> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 4 Jul 1997, George Foot wrote: > levity AT minn DOT net wrote: > : every time I try to compile this program with djgpp it gives me a parse > : error. Note that the code I am including is scaled down in an atmpt to > : isolate the problem. > > In C you are not allowed to define variables within a block; your > definition of `bmh' must come before any code in the block, i.e. before > the fopen call. C++ does allow you to define variables almost anywhere > though. Wrong! ANSI C does indeed allow one to define variables at the beginning of any block! C++ further adds the ability to define variables anywhere within a block. Please do not post mis-information. I do not clearly remember the original posting, but, I think that 'levity' was trying to define a variable in the statement of a for or while loop. If that was it, then since the statement itself is not within the block defined by its braces this is illegal in a C program. Art S. Kagel, kagel AT bloomberg DOT com