-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strnew.c
25 lines (22 loc) · 1.06 KB
/
ft_strnew.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aelphias <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/09/28 18:33:56 by aelphias #+# #+# */
/* Updated: 2019/09/28 18:47:39 by aelphias ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strnew(size_t size)
{
char *s;
s = (char *)malloc(sizeof(char) * size + 1);
if (!s)
return (NULL);
ft_memset(s, '\0', size + 1);
s[size] = '\0';
return (s);
}