-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strnew.c
31 lines (28 loc) · 1.19 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: pix <pix@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/10 13:05:07 by stales #+# #+# */
/* Updated: 2022/04/04 03:08:04 by pix ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
/**
* @brief Allocate and set all byte to null byte of size size
*
* @param dest Size of new string
*
* @return (char *) The new string
*/
char *ft_strnew(t_size size)
{
char *ptr;
ptr = (char *)malloc(size + 1);
if (ptr)
ft_bzero((char *)ptr, size + 1);
return (ptr);
}