/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strdup.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: vvobis +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/04 18:44:05 by vvobis #+# #+# */ /* Updated: 2024/04/12 10:44:23 by vvobis ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strdup(char const *s) { char *tmp; int i; i = 0; tmp = ft_calloc(ft_strlen(s) + 1, sizeof(*tmp)); if (!tmp) return (NULL); while (s[i]) { tmp[i] = s[i]; i++; } tmp[i] = 0; return (tmp); }