-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strdup.c
26 lines (23 loc) · 1.07 KB
/
ft_strdup.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lrocca <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/01/15 20:55:05 by lrocca #+# #+# */
/* Updated: 2021/05/08 18:56:31 by lrocca ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *s)
{
size_t len;
char *new;
len = ft_strlen(s);
new = malloc(len + 1);
if (!new)
return (NULL);
ft_strlcpy(new, s, len + 1);
return (new);
}