-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathft_calloc.c
25 lines (22 loc) · 1.08 KB
/
ft_calloc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gamarcha <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/04/15 21:14:47 by gamarcha #+# #+# */
/* Updated: 2021/04/15 21:14:47 by gamarcha ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_calloc(size_t nmemb, size_t size)
{
void *s;
size_t n;
n = nmemb * size;
s = malloc(n);
if (s == 0)
return (0);
return (ft_memset(s, 0, n));
}