-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strdup.c
More file actions
24 lines (21 loc) · 1.09 KB
/
ft_strdup.c
File metadata and controls
24 lines (21 loc) · 1.09 KB
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: joramire <joramire@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/27 17:44:34 by joramire #+# #+# */
/* Updated: 2022/09/27 18:01:16 by joramire ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *s1)
{
char *out;
out = (char *)malloc((ft_strlen(s1) + 1) * sizeof(char));
if (out == NULL)
return (NULL);
ft_strlcpy(out, (char *)s1, ft_strlen(s1) + 1);
return (out);
}