delorie.com/archives/browse.cgi | search |
From: | "John S. Fine" <johnfine AT erols DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: funny for and while loop and c++ problems |
Date: | Thu, 04 Feb 1999 14:37:49 -0500 |
Lines: | 34 |
Message-ID: | <36B9F70D.24CC@erols.com> |
References: | <36B9D646 DOT DFD01E97 AT hotmail DOT com> |
Mime-Version: | 1.0 |
X-Trace: | Op0G/Ibj85SVYfM6Y2RK6PY5CbdXrwZRz6L9HRQDSrg= |
X-Complaints-To: | abuse AT rcn DOT com |
NNTP-Posting-Date: | 4 Feb 1999 19:39:03 GMT |
X-Mailer: | Mozilla 3.01 (Win95; U) |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
pcgamesmaster AT hotmail DOT com wrote: > what is the difference between the first and second snippet of code? > why doesn't the first one work in djgpp? > > ======================================================================== > lp = 0; > while (!key[KEY_ENTER]) { > while (lp < 256) { . . . > } > lp += 1; > } > set_palette(pal); > } > ======================================================================== > while (!key[KEY_ENTER]) { > for (lp = 0; lp < 256; lp++) { . . . > } > } > set_palette(pal); > } > ======================================================================== > > i think the problem with the first one is that it doesn't execute the > innermost while loop. why? The most obvious difference is that the "lp=0" occurs ouside the outer loop in the first version and occurs inside the outer loop in the second. -- http://www.erols.com/johnfine/ http://www.geocities.com/SiliconValley/Peaks/8600/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |