-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_calloc.c
More file actions
33 lines (29 loc) · 1.26 KB
/
ft_calloc.c
File metadata and controls
33 lines (29 loc) · 1.26 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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_calloc.c :+: :+: */
/* +:+ */
/* By: farodrig <farodrig@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2020/12/04 15:30:55 by farodrig #+# #+# */
/* Updated: 2021/02/28 20:42:30 by farodrig ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
/*
** 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 *mem;
mem = malloc(size * count);
if (!mem)
{
return (0);
}
ft_bzero(mem, count * size);
return (mem);
}