base struct

This commit is contained in:
gazhonsepaskwa
2025-01-13 13:21:53 +01:00
parent a7e1a55200
commit 09c2cb5b3e
47 changed files with 1835 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/14 17:14:32 by nalebrun #+# #+# */
/* Updated: 2024/11/25 16:16:11 by nalebrun ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../libft.h"
char *ft_strjoin(const char *s1, const char *s2)
{
char *out;
unsigned int i;
unsigned int j;
if (!s1 && !s2)
return (NULL);
if (!s1)
return (ft_strdup(s2));
if (!s2)
return (ft_strdup(s1));
out = ft_calloc(ft_strlen(s1) + ft_strlen(s2) + 1, sizeof(char));
if (!out)
return (NULL);
i = 0;
j = 0;
while (s1[j])
out[i++] = s1[j++];
j = 0;
while (s2[j])
out[i++] = s2[j++];
return (out);
}