-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_calloc.c
More file actions
35 lines (31 loc) · 1.18 KB
/
ft_calloc.c
File metadata and controls
35 lines (31 loc) · 1.18 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabed <moabed@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/07 21:50:37 by moabed #+# #+# */
/* Updated: 2025/08/19 21:06:43 by moabed ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_calloc(size_t nmemb, size_t size)
{
void *p;
p = malloc(nmemb * size);
if (p == NULL)
{
return (p);
}
return (ft_memset(p, 0, nmemb * size));
}
/*
#include <stdio.h>
int main(void){
int *p = ft_calloc(20,4);
for(int i =0; i < 20; i++)
{
printf("%d ",p[i]);
}
}*/