-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_calloc.c
27 lines (24 loc) · 1.1 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
26
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: amahla <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/02 12:27:43 by amahla #+# #+# */
/* Updated: 2022/05/03 10:49:44 by amahla ### ########.fr */
/* */
/* ************************************************************************** */
#include"libft.h"
void *ft_calloc(size_t nmemb, size_t size)
{
void *dst;
size_t i;
i = 0;
dst = malloc(nmemb * size);
if (!dst)
return (NULL);
while (i < nmemb * size)
*((unsigned char *)dst + i++) = 0;
return (dst);
}