www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/06/12:59:31

From: Nicolas Blais <nicblais AT hotmail DOT com>
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: <E1FF8239A075D311AF7200A0C9D60AE30A64FB AT probe-2 DOT acclaim-euro DOT net>
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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019