/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strdup.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rzy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2026/08/24 01:09:08 by rzy #+# #+# */ /* Updated: 2026/08/24 01:09:25 by rzy ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strdup(const char *s) { int i; char *dup; dup = malloc(sizeof (char) * (ft_strlen(s) + 1)); if (dup == NULL) return (NULL); i = 0; while (s[i]) { dup[i] = s[i]; ++i; } dup[i] = 0; return (dup); }