From: flobere AT club-internet DOT fr Newsgroups: comp.os.msdos.djgpp Subject: Re: What's wrong with this code snippet ? Date: Sun, 17 Oct 1999 15:01:50 +0200 Organization: Club-Internet (France) Lines: 21 Message-ID: <3809C8BE.82C8A5F2@club-internet.fr> References: NNTP-Posting-Host: ppp-172-250.villette.club-internet.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: front3m.grolier.fr 940165290 7372 195.36.172.250 (17 Oct 1999 13:01:30 GMT) NNTP-Posting-Date: 17 Oct 1999 13:01:30 GMT X-Mailer: Mozilla 4.6 [fr] (Win95; I) X-Accept-Language: fr To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > // Set each element of the kill list to 999 > void empty_kill_list(int *list) > { > memset(list, 999, sizeof(int) * NUM_TILES); > } Hi, Very simple... the memset function prototype is : memset(void *ptr, char c, unsigned long size) The second arg is a CHAR. It means is in 8bits, it also means you cannot go over 255 using memset. That is why you cannot set your array to 999. Memset is only useful when you need to initialize an array to 0. It is not much more slower to use a for loop. The compiler will surely optimize it to a rep sto instructions.