Mail Archives: djgpp/1997/07/08/12:55:50
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
- Raw text -