1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.

33 lines
1.1 KiB
C
Raw Permalink Normal View History

2023-08-06 20:12:38 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ajoly <ajoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/28 18:42:08 by ajoly #+# #+# */
/* Updated: 2022/08/04 09:17:22 by ajoly ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
char *ft_strdup(char *src)
{
int i;
char *dest;
i = 0;
while (src[i])
i++;
dest = malloc(i);
i = 0;
while (src[i])
{
dest[i] = src[i];
i++;
}
dest[i] = '\0';
return (dest);
}