This commit is contained in:
rzy
2026-08-31 02:16:33 +02:00
commit 94cd5aac51
25 changed files with 705 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rzy <ry@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);
}