Message-Id: <199710220357.NAA14199@rabble.uow.edu.au> Subject: Re: Trouble with bools To: hahoyt AT eng2 DOT uconn DOT edu (H. Anthony Hoyt) Date: Wed, 22 Oct 1997 13:57:46 +1000 (EST) Cc: djgpp AT delorie DOT com (DJGPP) In-Reply-To: from "H. Anthony Hoyt" at "Oct 21, 97 09:00:33 pm" From: Brett Porter MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk > Little know fact (well, not really) is that you can initalize > your array as follows.. > > bool scrn[640][480] = {0}; > Are you sure? I don't ever recall seeing this done. > You could initalize every variable this way as well (Even 2D, 3D... nD > arrays) by just putting a comma (,) after ever variable. > Ex. > > bool foo[2][3] = { 0, 1, 0, 1, 0, 1}; > I'm almost certain this won't work, I think it should be {{0,1},{0,1},{0,1}} > (although most people tend to do the following to make it easier to > visualise) > > bool foo[2][3] = { 0, 1, 0 > 1, 0, 1}; > > (Could someone tell me if I'm wrong but I think this is possable.) > > Note though, by default if you initalize one variable of the array but not > the rest, the rest get set to 0 (zero). So.... > > bool foo[2][3] = {1}; > > only sets the first item of the array to 1 but the rest to 0. As for how > efficent (sp) this is, I don't know. There could very well be some un > desireable affects to this (which I would love to know myself) but it > works. > This is not really a standard as mar as I know. What is wrong with just memset(foo, 0, sizeof(foo)); ? > As for you current problem, I have no idea why it's not looping > properly. Is what you posted an exact code snip? How about walking > though it with rhide? > I couldn't see anything wrong with it either. Brett -- "Who here believes in telekenesis? Raise MY hand!" -- Brett Porter bporter AT rabble DOT uow DOT edu DOT au http://www.geocities.com/CollegePark/Union/3596 Humour, Programming, and more.