-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_calloc.c
26 lines (23 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: marcrodr < [email protected] +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/06/04 15:36:13 by user42 #+# #+# */
/* Updated: 2021/09/10 12:22:28 by marcrodr ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void *ft_calloc(size_t nitems, size_t size)
{
size_t total_size;
void *allocated;
total_size = nitems * size;
allocated = malloc(total_size);
if (allocated == NULL)
return (NULL);
ft_bzero(allocated, total_size);
return (allocated);
}