Name
halloc - Allocates a huge array.
Syntax
#include <malloc.h>
void huge *halloc(n, size);
long n;
size_t size;
Description
The halloc function allocates a huge array from the
operating system consisting of n elements, each of which is
size bytes long. Each element is initialized to 0. If the
size of the array is greater than 128K (131,072 bytes), then
the size of an array element must be a power of 2.
Return Value
The halloc function returns a void huge pointer to the
allocated space, guaranteed to be suitably aligned for
storage of any type of object. To get a pointer to a type
other than void huge, use a type cast on the return value.
The return value is NULL if the request cannot be satisfied.
See Also
calloc(S), free(DOS), hfree(DOS), malloc(DOS), realloc(S)
Example
#include <stdio.h> #include <malloc.h>
main()
{
long huge *lalloc;
lalloc = (long huge *)halloc(30000L,sizeof(long));
if (lalloc == NULL)
printf("Insufficient memory available");
else
printf("Memory successfully allocated");
}
This program uses halloc to allocate space for 30,000 long
integers.
(printed 6/18/89)