-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strdup.c
26 lines (23 loc) · 1.09 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: mbouderr <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/27 02:53:32 by mbouderr #+# #+# */
/* Updated: 2022/10/27 22:03:33 by mbouderr ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *s1)
{
char *str;
str = ft_calloc(ft_strlen((char *)s1) + 1, sizeof(char));
if (!str)
{
return (NULL);
}
ft_memmove(str, s1, ft_strlen((char *)s1) + 1);
return (str);
}