Mail Archives: djgpp/1997/08/11/16:52:04
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
- Raw text -