delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/07/00:25:34

From: "Damian Yerrick" <web DOT poison AT pineight DOT 8m DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Please help...matrix problem with Allegro
Date: Wed, 6 Oct 1999 19:58:27 -0500
Organization: Rose-Hulman Institute of Technology
Lines: 29
Message-ID: <7tgrbc$dfi$1@solomon.cs.rose-hulman.edu>
References: <E1FF8239A075D311AF7200A0C9D60AE30A64FB AT probe-2 DOT acclaim-euro DOT net> <7tfk6s$pih$1 AT nnrp1 DOT deja DOT com>
NNTP-Posting-Host: yerricde.laptop.rose-hulman.edu
X-Trace: solomon.cs.rose-hulman.edu 939258028 13810 137.112.205.146 (7 Oct 1999 01:00:28 GMT)
X-Complaints-To: news AT cs DOT rose-hulman DOT edu
NNTP-Posting-Date: 7 Oct 1999 01:00:28 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Shawn Hargreaves wrote:
> > 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.

Nicolas Blais <nicblais AT hotmail DOT com> wrote:
>
> What do you mean initialize to zero? Do you mean like
> matrix[x][y] = 0

Does this "matrix" have a whole bunch of falling
text strings printed vertically?

> or do something else?

Close. Put braces around the zero.

int matrix[HEIGHT][WIDTH] = {{0}};

Initializing the first element(s) of an array initializes the rest
to zero or NULL. Declaring a variable outside of function scope
(i.e. global) also zeroes it.


Damian Yerrick
http://come.to/yerrick


- Raw text -


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