-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strdup.c
More file actions
27 lines (24 loc) · 1.1 KB
/
ft_strdup.c
File metadata and controls
27 lines (24 loc) · 1.1 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
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mfrisby <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/07/11 13:28:33 by mfrisby #+# #+# */
/* Updated: 2017/07/11 13:28:34 by mfrisby ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
char *ft_strdup(const char *s1)
{
char *new;
size_t i;
i = 0;
i = ft_strlen(s1);
new = malloc(sizeof(char) * (i + 1));
if (new == NULL)
return (NULL);
new = ft_strcpy(new, s1);
return (new);
}