From: Nicolas Blais Newsgroups: comp.os.msdos.djgpp Subject: Re: Please help...matrix problem with Allegro Date: Wed, 06 Oct 1999 13:52:34 GMT Organization: Deja.com - Before you buy. Lines: 29 Message-ID: <7tfk6s$pih$1@nnrp1.deja.com> References: NNTP-Posting-Host: 206.167.109.2 X-Article-Creation-Date: Wed Oct 06 13:52:34 1999 GMT X-Http-User-Agent: Mozilla/4.08 [en] (Win95; I ;Nav) X-Http-Proxy: 1.0 FXGENS1, 1.0 x40.deja.com:80 (Squid/1.1.22) for client 206.167.109.2 X-MyDeja-Info: XMYDJUIDnicblais To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > 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. What do you mean initialize to zero? Do you mean like matrix[x][y] = 0 or do something else? Thanks. Allegro rules! -- nicblais AT hotmail DOT com Powered by FreeBSD! http://www.freebsd.org Sent via Deja.com http://www.deja.com/ Before you buy.