-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strdup.c
24 lines (21 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jfreitas <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/06/25 10:14:35 by jfreitas #+# #+# */
/* Updated: 2021/02/27 02:15:59 by jfreitas ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(char const *s1)
{
char *dest;
dest = (char*)malloc(sizeof(char) * ft_strlen(s1) + 1);
if (dest == NULL)
return (NULL);
ft_strcpy(dest, s1);
return (dest);
}