-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_calloc.c
More file actions
29 lines (25 loc) · 1.27 KB
/
ft_calloc.c
File metadata and controls
29 lines (25 loc) · 1.27 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fsanz-ex <fsanz-ex@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/07 15:23:02 by fsanz-ex #+# #+# */
/* Updated: 2023/02/09 20:04:23 by fsanz-ex ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "libft.h"
/*contiguously allocates enough space for count objects that are size bytes
of memory each and returns a pointer to the allocated memory. The allocated
memory is filled with bytes of value zero*/
void *ft_calloc(size_t count, size_t size)
{
void *ptr;
ptr = malloc(count * size);
if (ptr == NULL)
return (NULL);
ft_bzero(ptr, count * size);
return (ptr);
}