Message-ID: <3787A5EB.ECDE729A@vetec.com> Date: Sat, 10 Jul 1999 14:58:35 -0500 From: Andy Goth X-Mailer: Mozilla 4.61 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: it's amazing (at least for me) References: <378618ca DOT 3495674 AT news DOT telepac DOT pt> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com > In this little C program if i change the type of variable k (in setup > function) to byte the program don't work. Can anyone explain me why? > Thanks > > APeres. > > ------------------------------------------------------------------------------------ > typedef unsigned char byte; > typedef unsigned char pallette[256][3]; > > void setup(pallette); > > int main(void) > { > int i; > pallette pall; > > setup(pall); > > for(i=0; i < 256; i++) > printf("%d ------- %d\n", i, pall[i][0]); > > return 1; > > } > > void setup(pallette pall) > { > int k; > > for(k=0; k < 256; k++) > pall[k][0] = pall[k][1] = pall[k][2] = i; A byte ranges from 0 to 255 (unsigned), so a byte-sized (hehehe) value will *always* be less than 256. > } -- ___ _ _ ____ _ _ / _ \| \ | | _ \\ \_/ / .--------[ ICQ#: 35256413 ]--------. | |_| | \| | | | |\ / | 01001000011001010110110001101100 | | _ | \ \ | | | | | | | 01101111001011000010000001110111 | | | | | |\ | |_| | | | | 01101111011100100110110001100100 | |_| |_|_| \_|____/ |_| `--[ mailto:andygoth AT vetec DOT com ]---'