1 The malloc() function allocates size bytes and returns a pointer 2 to the allocated memory. The memory is not initialized. If size 3 is 0, then malloc() returns either NULL, or a unique pointer value 4 that can later be successfully passed to free(). 5 6 The free() function frees the memory space pointed to by ptr, 7 which must have been returned by a previous call to malloc(), cal‐ 8 loc(), or realloc(). Otherwise, or if free(ptr) has already been 9 called before, undefined behavior occurs. If ptr is NULL, no op‐ 10 eration is performed. 11 12 The calloc() function allocates memory for an array of nmemb ele‐ 13 ments of size bytes each and returns a pointer to the allocated 14 memory. The memory is set to zero. If nmemb or size is 0, then 15 calloc() returns either NULL, or a unique pointer value that can 16 later be successfully passed to free(). If the multiplication of 17 nmemb and size would result in integer overflow, then calloc() re‐ 18 turns an error. By contrast, an integer overflow would not be de‐ 19 tected in the following call to malloc(), with the result that an 20 incorrectly sized block of memory would be allocated: 21 22 malloc(nmemb * size); 23