-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strnew.c
executable file
·27 lines (24 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vportell <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/31 08:08:14 by vportell #+# #+# */
/* Updated: 2016/11/02 23:19:12 by vportell ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strnew(size_t size)
{
int i;
char *s;
i = (int)size + 1;
s = (char *)malloc(sizeof(char) * i);
if (!s)
return (NULL);
while (i--)
s[i] = '\0';
return (s);
}