chowto calloc code example
Example 1: c calloc
// The Malloc way
void *ptr = malloc(sizeof(Type) * n_elem);
// The Calloc way
void *ptr = calloc(n_elem, sizeof(Type));
Example 2: calloc
void *calloc(size_t nitems, size_t size)
// The Malloc way
void *ptr = malloc(sizeof(Type) * n_elem);
// The Calloc way
void *ptr = calloc(n_elem, sizeof(Type));
void *calloc(size_t nitems, size_t size)