1
0
mirror of https://github.com/KeyZox71/ft_minipowershell.git synced 2025-05-14 00:08:47 +02:00

」 feat(libft): added a very cool feature !

This commit is contained in:
2024-04-24 10:53:46 +02:00
parent 28128acd72
commit 59b810ffa4
64 changed files with 2063 additions and 0 deletions

41
libft/str/ft_strjoin.c Normal file
View File

@ -0,0 +1,41 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/04 13:44:09 by adjoly #+# #+# */
/* Updated: 2024/02/04 14:45:30 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "../libft.h"
char *ft_strjoin(char const *s1, char const *s2)
{
char *result;
size_t i;
size_t j;
i = 0;
j = 0;
if (s1 == NULL || s2 == NULL)
return (NULL);
result = ft_calloc((ft_strlen(s1) + ft_strlen(s2) + 1), sizeof(char));
if (result == NULL)
return (NULL);
while (s1[i])
{
result[i] = s1[i];
i++;
}
while (s2[j])
{
result[i] = s2[j];
i++;
j++;
}
result[i] = '\0';
return (result);
}