-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_calloc.c
32 lines (29 loc) · 1.25 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: estettle <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/11 11:46:30 by estettle #+# #+# */
/* Updated: 2024/10/11 11:46:32 by estettle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Allocates count * size bytes and sets them all to 0.
*
* @param count The number of objects to allocate.
* @param size The size of each object to allocate.
*/
void *ft_calloc(size_t count, size_t size)
{
void *area;
size_t b_size;
b_size = count * size;
area = malloc(b_size);
if (!area)
return (NULL);
ft_bzero(area, b_size);
return (area);
}