-
Notifications
You must be signed in to change notification settings - Fork 9
/
ft_strdup.c
26 lines (23 loc) · 1.08 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: rchallie <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/10 11:17:17 by rchallie #+# #+# */
/* Updated: 2019/10/14 16:51:55 by rchallie ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *s1)
{
char *rtn;
size_t len;
len = ft_strlen(s1) + 1;
rtn = malloc(sizeof(char) * len);
if (!rtn)
return (0);
rtn = ft_memcpy(rtn, s1, len);
return (rtn);
}