ft_calloc - gabrielcoelhodacunha-old/42sp-libft GitHub Wiki

Description

Allocates space for number objects, each with size bytes. After allocation, initializes each object to a zero byte.

Implementation

void	*ft_calloc(size_t number, size_t size)
{
	size_t	total;
	void	*ptr;

	total = number * size;
	ptr = malloc(total);
	if (!ptr)
		return (NULL);
	ft_bzero(ptr, total);
	return (ptr);
}

References