42_libft/ft_calloc.c

25 lines
1.1 KiB
C
Raw Normal View History

2022-09-27 10:29:23 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/27 16:09:01 by cchauvet #+# #+# */
/* Updated: 2022/09/27 16:12:30 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *calloc(size_t nmemb, size_t size)
{
char *tab;
if (nmemb * size == 0)
return (NULL);
tab = malloc(nmemb * size);
ft_bzero(tab, nmemb * size);
return (tab);
}