-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strdup.c
25 lines (22 loc) · 1.06 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: emdi-mar <emdi-mar@student.42roma.it> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/08 18:28:39 by emdi-mar #+# #+# */
/* Updated: 2024/11/08 18:29:20 by emdi-mar ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *s1)
{
size_t len;
char *str;
len = ft_strlen(s1) + 1;
str = ft_calloc(len, sizeof(*str));
if (str)
ft_memcpy(str, s1, len);
return (str);
}