Silly question...

Joel Kolstad bbs00068 at uafcseg.uucp
Fri Jul 6 12:58:51 AEST 1990


OK, You C Gurus out there... tell me something...  I want to go off and
allocate 2K of memory where I can store a bunch on numbers from 0-255.
This is on a PC, and the unsigned chars on my C compiler are 8 bits...
So, I thought I'd do this:

typedef unsigned char MyBytes;
MyBytes Mem[];
Mem=(MyBytes *) calloc(MemSize,1); /* MemSize=2048 */

But my compiler doesn't like this!  Instead, I have to replace the second line
with:

MyBytes *Mem; 

This is certainly equivalent, and the compiler eats it, but why doesn't the
first method work!?!?  Thanks!

Please mail replies to kolstad at cae.wisc.edu, since I don't log onto this
BBS to often (cae.wisc.edu is unable to post news right now!)

				---Joel Kolstad



More information about the Comp.lang.c mailing list