Microsoft C V5.1 halloc() problem.
Cliff Lum
a50 at mindlink.UUCP
Sat Aug 4 08:21:26 AEST 1990
A NULL return indicates a memory allocation fail because of insufficient space
or bad values of the arguments.
here is some sample code
#include <malloc.h>
#define MAX_SIZE 100000L
main()
short huge *larray;
if (( larray = (short huge *)halloc(MAX_SIZE, sizeof(short))) == NULL
{
printf("Alocation by halloc failed ");
exit(0);
}
printf("Allocated");
hfree(void huge *)larray); /* free the array */
} /* also missing the { after main() */
example call
p_huge = (short huge *)halloc(100000, sizeof(short));
More information about the Comp.lang.c
mailing list