-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_calloc.c
More file actions
30 lines (26 loc) · 1.23 KB
/
ft_calloc.c
File metadata and controls
30 lines (26 loc) · 1.23 KB
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
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kmoutaou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/08 10:52:07 by kmoutaou #+# #+# */
/* Updated: 2021/11/19 14:07:50 by kmoutaou ### ########.fr */
/* */
/* ************************************************************************** */
/*
ft_calloc is a re-coded -calloc- function from <>stdlib.h> that allocates
memory for an array of -count- objects of the size -size- and initializes
all its bytes to zero.
*/
#include "libft.h"
void *ft_calloc(size_t count, size_t size)
{
void *ptr;
ptr = (void *) malloc(count * size);
if (!ptr)
return (ptr);
ft_bzero(ptr, count * size);
return (ptr);
}