-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathft_calloc.c
More file actions
39 lines (35 loc) · 1.56 KB
/
Copy pathft_calloc.c
File metadata and controls
39 lines (35 loc) · 1.56 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
31
32
33
34
35
36
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cado-car <cado-car@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/30 20:21:13 by cado-car #+# #+# */
/* Updated: 2021/07/31 11:12:59 by cado-car ### ########lyon.fr */
/* */
/* ************************************************************************** */
/*
* LIBRARY
* #include <stdlib.h>
* DESCRIPTION
* The calloc() function 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.
* PARAMETERS
* #1. The count of objects to allocate.
* #2. The size of bytes in each object.
* RETURN VALUES
* If successful, calloc() function returns a pointer to allocated memory.
* If there is an error, they return a NULL pointer.
*/
#include "libft.h"
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);
}