-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_calloc.c
27 lines (24 loc) · 1.13 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: harslan <harslan@student.42istanbul.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/13 16:59:40 by harslan #+# #+# */
/* Updated: 2022/09/08 03:17:18 by harslan ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_calloc(size_t count, size_t size)
{
void *array;
array = malloc(count * size);
if (array == NULL)
{
return (NULL);
}
if (count == SIZE_MAX || size == SIZE_MAX)
return (NULL);
return (ft_memset(array, 0, size * count));
}