libft
src
ft_strnew.c
Go to the documentation of this file.
1
/* ************************************************************************** */
3
/* */
4
/* ::: :::::::: */
5
/* ft_strnew.c :+: :+: :+: */
6
/* +:+ +:+ +:+ */
7
/* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8
/* +#+#+#+#+#+ +#+ */
9
/* Created: 2019/09/05 00:33:06 by unite #+# #+# */
10
/* Updated: 2020/07/16 02:42:45 by unite ### ########.fr */
11
/* */
12
/* ************************************************************************** */
13
14
#include "
libft.h
"
15
25
char
*
ft_strnew
(
size_t
size)
26
{
27
if
(size + 1 < size)
28
return
(NULL);
29
return
(
ft_memalloc
(
sizeof
(
char
) * (size + 1)));
30
}
libft.h
ft_strnew
char * ft_strnew(size_t size)
Allocates a fresh string.
Definition:
ft_strnew.c:25
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