Summary: Memory Management Functions (cont)
void *calloc(size_t nelems, size_t nbytes)
- aim: create a new array with memory zero'd
-
nelems is the number of elements
-
nbytes is the size of each element
- allocates a memory block of size
nelems*nbytes bytes
- if successful, all bytes in memory block are set to zero
- if insufficient memory, returns
NULL
|