/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strdup.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dgaillet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/11/05 19:31:29 by dgaillet #+# #+# */ /* Updated: 2025/11/06 10:07:22 by dgaillet ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strdup(const char *s) { char *dest; int i; dest = malloc(sizeof(char) *(ft_strlen(s) + 1)); if (!dest) return (NULL); i = 0; while (s[i]) { dest[i] = s[i]; i++; } dest[i] = '\0'; return (dest); }