Message-ID: From: Shawn Hargreaves To: djgpp AT delorie DOT com Subject: Re: Please help...matrix problem with Allegro Date: Wed, 6 Oct 1999 10:20:11 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain; charset="iso-8859-1" Reply-To: djgpp AT delorie DOT com nicblais AT my-deja DOT com writes: > unsigned int matrix[res_x][res_y]; Depending on how big res_x and res_y are, this might be overflowing your stack: there is only limited space for local variables, so it would be better to use dynamic allocation (ie. malloc) for any big arrays. > pix_x = (random() % res_x) + 1; This is a potential array overflow: C arrays count from zero, so you don't want that + 1 on the end. Also, you didn't initialise your array to anything, so the starting contents are random. You need to fill it with zeros before you can sensibly check for whether values are set or not. Shawn Hargreaves.