Definition | #include <stdlib.h> void *calloc(size_t n, size_t elsize);
| |
Return val. | Pointer to the new memory space | |
if sufficient memory space is present. | ||
NULL pointer | if memory space does not suffice for the request. | |
Notes | The new data area begins on a doubleword boundary. To ensure that you are requesting the correct size for an array element, you should use the A serious disruption in working memory may be expected if the length of the memory area If n or elsize has the value 0, | |
Example | The following program fragment requests memory space for 20 array elements of type #include <stdlib.h> long *long_array; . . long_array = (long *)calloc(20, sizeof(long)); | |
See also | malloc, realloc, free, garbcoll |