Mail Archives: djgpp/2003/08/06/00:12:06
Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de> wrote in message news:<bgntiv$5oq$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>...
> JBS30000 <jbs30000 AT aol DOT com> wrote:
>
> > I figured out the problem. The array goes 0-5, 0-6, 0-5 but I was
> > supposed to put unsigned char Dither[6][7][6]; Like I said, the
> > answer was very obvious. Sorry about that.
>
> Nothing to be sorry about. Here's another suggestion to improve the quality
> of that source code a bit:
>
> 1) lose those tons of commented-out numbers. They really make the
> code hard to read for no apparent gain.
>
> 2) You have an array of arrays of arrays of numbers, here, but your
> initializer doesn't reflect that. The language does allow the way you
> did it, overflowing from one sub-array into the next, but it's not
> particularly good style. Instead, consider
>
> unsigned char Dither [6][7][6] = {
> { { first sub-sub-array},
> { second sub-sub-array} },
> { {first sub-sub-array in second sub-array},
> { ... } },
> { ... }
> };
>
> The indentation is just visual sugar, but the additional pairs of { }
> provide real value --- they'll make it harder to miscount entries
> inside the array.
Thanks. Oh, and for the record, Joel is what's used as my name if I'm
posting on Google Groups and JBS30000 is what will show up as my name
if I post in
http://www.cs.berkeley.edu/Newspages/comp.os.msdos.html
Anyway, the commentented out numbers are for me and do have a reason
for being there. As for your second point, thanks, I'll give it a
try. I haven't made too many programs using multi dimension arrays
and wasn't aware of the proper way to initialize them. I just figured
that 6 * 7 * 6 = 252 so if I initalized the array with 252 elements
there would be no problem.
- Raw text -