-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_calloc.c
29 lines (26 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
28
29
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: matlopes <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/07 09:39:04 by matlopes #+# #+# */
/* Updated: 2023/11/07 09:39:06 by matlopes ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_calloc(size_t count, size_t size)
{
void *pointer;
if (count == 0 || size == 0)
{
count = 1;
size = 1;
}
pointer = malloc(count * size);
if (!pointer)
return (NULL);
ft_bzero(pointer, count * size);
return (pointer);
}