Problems allocating 300k data structure using Turbo C
Mike Percy
grimlok at hubcap.clemson.edu
Tue Mar 19 04:52:18 AEST 1991
Try
POINT huge *p;
p = farmalloc(300000UL);
if(!p) /* error ... */
for(long i = 0; i < 300000L; p[i++] = 0);
/* the above might not work, the [] operator may take only ints, I can't
remember. If so, the following should work */
for(long i = 0; i < 300000L; *(p + i++) = 0);
You can use any model except the tiny model.
Check out the section on pointer arithmetic in the Programmer's Guide
(p. 57 in my copy).
"I don't know about your brain, but mine is really...bossy."
Mike Percy grimlok at hubcap.clemson.edu
ISD, Clemson University mspercy at clemson.BITNET
(803)656-3780 mspercy at clemson.clemson.edu
More information about the Comp.lang.c
mailing list