ft_calloc.c
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* ft_calloc.c :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: abonnard <abonnard@student.42nice.fr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2024/11/04 17:39:27 by abonnard #+# #+# */ 9 /* Updated: 2024/11/05 17:25:43 by abonnard ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include <stdlib.h> 14 #include "../include/libft.h" 15 16 void *ft_calloc(size_t count, size_t size) 17 { 18 void *ptr; 19 20 ptr = malloc(count * size); 21 if (!ptr) 22 return (0); 23 ft_bzero(ptr, count * size); 24 return (ptr); 25 }