-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_calloc.c
More file actions
31 lines (28 loc) · 1.18 KB
/
Copy pathft_calloc.c
File metadata and controls
31 lines (28 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_calloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: alexfran <alexfran@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/17 11:05:12 by alexfran #+# #+# */
/* Updated: 2025/12/01 17:24:04 by alexfran ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <stdlib.h>
void *ft_calloc(size_t elementCount, size_t elementSize)
{
void *memory;
size_t i;
i = 0;
memory = malloc(elementCount * elementSize);
if (!memory)
return (NULL);
while (i < elementCount * elementSize)
{
((char *)memory)[i] = '\0';
i++;
}
return (memory);
}