-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strnew.c
32 lines (29 loc) · 1.13 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
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lubaujar <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/09 20:56:55 by lubaujar #+# #+# */
/* Updated: 2014/11/13 14:34:51 by lubaujar ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strnew(size_t size)
{
char *str;
unsigned int i;
str = (char *)malloc(sizeof(char *) * size + 1);
i = 0;
if (str == NULL)
return ((char *)NULL);
else
{
while (i++ < size)
{
str[i] = 0;
}
}
return ((char *)str);
}