-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strnew.c
executable file
·30 lines (27 loc) · 1.09 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mberger <mberger@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/09 11:51:07 by mberger #+# #+# */
/* Updated: 2014/11/11 17:26:11 by mberger ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strnew(size_t size)
{
char *str;
size_t i;
i = 0;
str = (char*)malloc(sizeof(char) * size);
if (str == NULL)
return (NULL);
while (i < size)
{
str[i] = '\0';
i++;
}
return (str);
}