-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strnew.c
31 lines (28 loc) · 1.11 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
26
27
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sgrindhe <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/07/09 11:18:12 by sgrindhe #+# #+# */
/* Updated: 2018/08/12 01:40:24 by sgrindhe ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strnew(size_t size)
{
size_t i;
char *newstr;
newstr = (char*)malloc(size + 1);
if (newstr == NULL)
return (NULL);
i = 0;
while (i < size)
{
newstr[i] = '\0';
i++;
}
newstr[i] = '\0';
return (newstr);
}