-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strnew.c
28 lines (25 loc) · 1.07 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: knzeng-e <knzeng-e@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/03/21 05:41:34 by knzeng-e #+# #+# */
/* Updated: 2016/03/30 00:25:02 by knzeng-e ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strnew(size_t size)
{
char *str;
size_t i;
i = 0;
str = (char *)malloc(sizeof(char) * size + 1);
if (str)
{
while (i <= size)
str[i++] = '\0';
}
return (str);
}