-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strnew.c
31 lines (28 loc) · 1.12 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: amatshiy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/05/29 00:26:10 by amatshiy #+# #+# */
/* Updated: 2017/06/11 09:47:33 by amatshiy ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strnew(size_t size)
{
char *newstr;
size_t x;
newstr = (char *)malloc(size + 1);
if (newstr == NULL)
return (NULL);
x = 0;
while (x < size)
{
newstr[x] = '\0';
x++;
}
newstr[x] = '\0';
return (newstr);
}