/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strdup.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/19 14:07:50 by narnaud #+# #+# */ /* Updated: 2022/03/24 09:22:49 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ #include "../libft.h" char *ft_strdup(const char *src) { char *dup; size_t i; i = 0; dup = malloc((ft_strlen(src) + 1) * sizeof(char)); if (!dup) return (NULL); while (src[i]) { dup[i] = src[i]; i++; } dup[i] = '\0'; return (dup); }