Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
calloc Functions
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The calloc family of functions allocates storage space for an
array of <num> elements, each <size> bytes in length. Each element
is initialized to 0.
In large data models (compact-, large-, and huge-model programs),
calloc maps to _fcalloc. In small data models (tiny-, small-, and
medium-model programs), calloc maps to _ncalloc.
The various calloc functions allocate storage space in the data
segments shown in the list below:
Function Heap Segment
calloc Depends on data model of program
_bcalloc Based heap, specified by <seg> segment selector
_fcalloc Far heap (outside default data segment)
_ncalloc Near heap (inside default data segment)
Return Value
The calloc functions return a pointer to the allocated space. The
storage space pointed to by the return value is guaranteed to be
suitably aligned for storage of any type of object. To get a
pointer to a type other than void, use a type cast on the return
value.
The _fcalloc and _ncalloc functions return NULL if there is
insufficient memory available or if <num> or <size> is 0. The
_bcalloc function returns _NULLOFF in this case.
-♦-