-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_calloc.c
26 lines (23 loc) · 1.12 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yettabaa <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/07 18:07:02 by yettabaa #+# #+# */
/* Updated: 2022/11/19 22:07:36 by yettabaa ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_calloc(size_t nitems, size_t size)
{
void *blk;
if (nitems >= SIZE_MAX || size >= SIZE_MAX)
return (NULL);
blk = (void *) malloc(nitems * size);
if (!blk)
return (NULL);
ft_bzero(blk, (nitems * size));
return (blk);
}