-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strdup.c
executable file
·23 lines (20 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jpinyot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/09 20:54:34 by jpinyot #+# #+# */
/* Updated: 2017/11/09 22:34:34 by jpinyot ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strdup(const char *str)
{
char *copy;
if (!(copy = (char *)malloc(sizeof(char) * (ft_strlen(str) + 1))))
return (NULL);
else
return (ft_strcpy(copy, str));
}