forked from josanri/Libft_extended
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_calloc.c
33 lines (30 loc) · 1.32 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
27
28
29
30
31
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aalvarez <aalvarez@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/17 01:30:32 by aalvarez #+# #+# */
/* Updated: 2022/08/17 19:24:27 by aalvarez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
/**
* @brief allocates size bytes and
* return a pointer to the allocated memory.
*
* @param count number of elements to be allocated.
* @param size size of each element allocated
* @return void* the resultant byte allocation.
*/
void *ft_calloc(size_t count, size_t size)
{
void *result;
result = malloc(count * size);
if (!result)
return (NULL);
ft_bzero(result, (count * size));
return (result);
}