-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_calloc.c
26 lines (23 loc) · 1.08 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ikgonzal <ikgonzal@student.42urduliz.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/06/10 19:43:42 by ikgonzal #+# #+# */
/* Updated: 2021/07/14 17:04:30 by ikgonzal ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_calloc(size_t nmemb, size_t size)
{
unsigned int str;
char *ptr;
str = nmemb * size;
ptr = malloc(str);
if (ptr == NULL)
return (NULL);
ft_memset(ptr, 0, str);
return (ptr);
}