From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) Newsgroups: comp.os.msdos.djgpp Subject: Re: segmentation fault... Date: 8 Aug 1997 08:09:28 GMT Organization: The National Capital FreeNet Lines: 30 Message-ID: <5sek7o$kcv@freenet-news.carleton.ca> References: <33E99579 DOT 8B2 AT gapeach DOT com> Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) NNTP-Posting-Host: freenet2.carleton.ca To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Jacob Martin (jake AT gapeach DOT com) writes: > A little background: > > DJGPP V 2.1, Allegro, > > I'm making a random map generator, and I programmed the whole generator > for a 2D map array. > > For access reasons, I'm converting that 2D array into a 1D array. If I > leave my map as a 2D array, I have none of the exceptions listed > below... > > BUT, If I keep my 2D and add a 1D..... > > int map[100][255],map[25500]; Are these local variables in a function? If so, you are smashing the stack: you start by allocating 102000 bytes, then you allocate another 102000, and the stack ends at about 200K. You need to allocate this stuff on the heap...use malloc, and free it at the end of the function, or make them static variables, or if you're using C++ use new and delete. -- .*. Where feelings are concerned, answers are rarely simple [GeneDeWeese] -() < When I go to the theater, I always go straight to the "bag and mix" `*' bulk candy section...because variety is the spice of life... [me] Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh