-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strnew.c
executable file
·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: ioleksiu <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/20 15:50:35 by ioleksiu #+# #+# */
/* Updated: 2016/12/20 20:26:26 by ioleksiu ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strnew(size_t size)
{
char *area;
size_t i;
i = 0;
area = (char *)malloc(size + 1);
if (!area)
return (NULL);
while (i < size)
{
((char*)area)[i] = '\0';
i++;
}
((char*)area)[i] = '\0';
return ((char *)area);
}