mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2026-10-19 03:30:07 +02:00
「✨」 feat(libft): added a very cool feature !
This commit is contained in:
1 parent
28128acd72
commit
59b810ffa4
64 files changed
+2063
No files matched your search
@@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strdup.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/03 22:57:39 by adjoly #+# #+# */
|
||||
/* Updated: 2024/02/04 14:44:58 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../libft.h"
|
||||
|
||||
char *ft_strdup(const char *s)
|
||||
{
|
||||
int i;
|
||||
char *result;
|
||||
int len;
|
||||
|
||||
i = 0;
|
||||
len = ft_strlen(s);
|
||||
result = malloc(sizeof(char) * (len + 1));
|
||||
if (result == NULL)
|
||||
return (NULL);
|
||||
while (s[i])
|
||||
{
|
||||
result[i] = s[i];
|
||||
i++;
|
||||
}
|
||||
result[i] = '\0';
|
||||
return (result);
|
||||
}
|
||||
Reference in new issue
Block a user