-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strdup.c
More file actions
26 lines (23 loc) · 1.11 KB
/
ft_strdup.c
File metadata and controls
26 lines (23 loc) · 1.11 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
25
26
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_strdup.c :+: :+: */
/* +:+ */
/* By: nsterk <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/09/24 21:24:38 by nsterk #+# #+# */
/* Updated: 2021/03/03 01:41:57 by nsterk ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *src)
{
char *rstr;
size_t len;
len = ft_strlen((char *)src);
rstr = (char *)malloc(sizeof(*rstr) * (len + 1));
if (!rstr)
return (NULL);
rstr = ft_strcpy(rstr, src);
return (rstr);
}