www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/19/21:51:54

From: aho450s AT nic DOT smsu DOT edu (Tony O'Bryan)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: for loop problem
Date: Sun, 19 Jan 1997 14:19:03 GMT
Organization: Southwest Missouri State University
Lines: 14
Message-ID: <32e22d4d.4649451@ursa.smsu.edu>
References: <32e11fa9 DOT 92123011 AT redwood DOT cs DOT sc DOT edu>
NNTP-Posting-Host: forseti.i53.smsu.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sat, 18 Jan 1997 19:11:57 GMT, boyer AT cs DOT sc DOT edu (Daniel Boyer) wrote:

>Ok, can somebody please tell me what is wrong with this line of code:
>
>	for(char SIX = 'a'; SIX < '}'; SIX++)
>	{
>	.....
>	}

You are attempting to compile this source from a C file.  C does not allow new
variables to be declared within a loop; that is an extension provided in C++.
If you try that in Turbo C, it will work since Borland's compiler doesn't
strictly enforce the ANSI C standard.  As an aside, if you instruct Turbo C to
strictly enforce the ANSI standard, their own header files won't compile. :)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019