-
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.28 KB
/
ft_calloc.c
File metadata and controls
31 lines (28 loc) · 1.28 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: ymassiou <ymassiou@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/04 11:04:23 by ymassiou #+# #+# */
/* Updated: 2023/11/26 00:20:05 by ymassiou ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_calloc(size_t count, size_t size)
{
void *result;
result = NULL;
if ((count * size) > SIZE_T_MAX)
return (NULL);
result = malloc(count * size);
if (result == NULL)
return (NULL);
return (ft_memset(result, 0, count * size));
}
int main ()
{
char *p = (char *)calloc(184467440737095,18446744073709551615);
char *p1 = (char *)ft_calloc(184467440737095,18446744073709551615);
}