Files
42_INT_01_libft/OLDsrc/str/ft_strnew.c
2019-11-06 18:42:13 +01:00

28 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/14 21:19:08 by hulamy #+# #+# */
/* Updated: 2019/03/25 15:25:38 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
/*
** create a new string of length size, fill with zero, and return pointer to it
*/
#include "libft.h"
char *ft_strnew(size_t size)
{
char *str;
if (!(str = (char *)malloc(sizeof(char) * (size + 1))))
return (NULL);
ft_bzero(str, size + 1);
return (str);
}