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.
. . .
ptr = malloc(100 * sizeof(int));
ptr = calloc(100, sizeof(int));
With calloc(), all cells are initialized to zero. With malloc() the cells are uninitialized (contain cabbage values).