Mail Archives: djgpp/1999/10/17/12:25:22
First guess is...You pass to memset an array of INT, but my def of
memset states that is "sets each BYTE in the block...yadayadayada".
so....you're initializing kill_list on a byte by byte basis, rather than
an int by int, which is what you seem to want to do.
Kevin wrote:
> 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 -