-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strnew.c
26 lines (23 loc) · 1.08 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mfebvay <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/11/24 21:51:45 by mfebvay #+# #+# */
/* Updated: 2015/01/28 18:12:53 by mfebvay ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
char *ft_strnew(size_t size)
{
char *str;
size_t i;
if (!(str = (char *)malloc((size + 1) * sizeof(char))))
return (NULL);
i = -1;
while (++i < size)
str[i] = '\0';
return (str);
}