-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strnew.c
27 lines (24 loc) · 1.15 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
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_strnew.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: cgarrot <[email protected]> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/10/07 07:21:23 by cgarrot #+# ## ## #+# */
/* Updated: 2018/10/08 15:47:21 by cgarrot ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
char *ft_strnew(size_t size)
{
char *str;
if (size != 0)
size++;
if (!(str = (char*)malloc(sizeof(char) * size)))
return (0);
while (size--)
str[size] = '\0';
return (str);
}