delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/17/08:36:34

From: Kevin <krugman AT nospam DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: What's wrong with this code snippet ?
Date: Sun, 17 Oct 1999 12:12:02 +0100
Message-ID: <c6wJONRNMABaX1eVyyz+aTSlhqUz@4ax.com>
NNTP-Posting-Host: reality-bytes.demon.co.uk
X-NNTP-Posting-Host: reality-bytes.demon.co.uk:212.228.30.60
X-Trace: news.demon.co.uk 940158797 nnrp-04:5682 NO-IDENT reality-bytes.demon.co.uk:212.228.30.60
X-Complaints-To: abuse AT demon DOT net
X-Newsreader: Forte Agent 1.6/32.525
MIME-Version: 1.0
Lines: 29
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi all.

yet another dumb question, but I can't seem to spot 
where I'm going wrong.



const int NUM_TILES = 320;  // This is global

int kill_list[NUM_TILES];   // This isn't

empty_kill_list(kill_list);

// Set each element of the kill list to 999
void empty_kill_list(int *list)
{
  memset(list, 999, sizeof(int) * NUM_TILES);
}

this doesn't set any of the kill list elements to 999,
when I look at them, they appear to have been set to
some unfeasably large negative number.

using a for loop to set the elements works fine, but is 
probably much slower.

Any ideas ?

Kevin.

- Raw text -


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