libft
src
ft_memalloc.c
Go to the documentation of this file.
1
/* ************************************************************************** */
3
/* */
4
/* ::: :::::::: */
5
/* ft_memalloc.c :+: :+: :+: */
6
/* +:+ +:+ +:+ */
7
/* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8
/* +#+#+#+#+#+ +#+ */
9
/* Created: 2019/09/05 00:27:33 by unite #+# #+# */
10
/* Updated: 2020/07/16 03:00:08 by unite ### ########.fr */
11
/* */
12
/* ************************************************************************** */
13
14
#include "
libft.h
"
15
#include <stdlib.h>
16
24
void
*
ft_memalloc
(
size_t
size)
25
{
26
char
*mem;
27
28
mem = malloc(size);
29
if
(mem == NULL)
30
return
(NULL);
31
ft_memset
(mem, 0, size);
32
return
(mem);
33
}
ft_memset
void * ft_memset(void *b, int c, size_t len)
Replicates behaviour of memset from libc.
Definition:
ft_memset.c:20
libft.h
ft_memalloc
void * ft_memalloc(size_t size)
Allocates memory of a given size and initializes it to 0.
Definition:
ft_memalloc.c:24
Generated by
1.8.16