calloc() function
The library function calloc() is like malloc() except that it takes two arguments, first for the number of cells and second argument for the byte size of each of the cells.
#include <stdlib.h>
. . .
int *ptr;
ptr = malloc(100 * sizeof(int));
or
ptr = calloc(100, sizeof(int));
With calloc(), all cells are initialized to zero. With malloc() the cells are uninitialized (contain cabbage values).