-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strdup.c
23 lines (20 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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_strdup.c :+: :+: */
/* +:+ */
/* By: splattje <splattje@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2023/10/09 10:50:30 by splattje #+# #+# */
/* Updated: 2023/10/09 11:08:38 by splattje ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *s)
{
char *duplicate;
duplicate = malloc(ft_strlen(s) + 1);
if (duplicate != NULL)
ft_strlcpy(duplicate, s, ft_strlen(s) + 1);
return (duplicate);
}