/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_calloc.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/09/27 16:09:01 by cchauvet #+# #+# */ /* Updated: 2022/10/28 17:31:12 by cchauvet ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void *ft_calloc(size_t nmemb, size_t size) { void *tab; if (nmemb != 0 && (size_t)(nmemb * size) / nmemb != size) return (NULL); tab = malloc(nmemb * size); if (tab == NULL) return (NULL); ft_bzero(tab, nmemb * size); return (tab); }