philosophers/philo_two/srcs/ft_strjoin.c
Matthos Denys 5f1937beec update
2021-05-18 21:36:56 +03:00

23 lines
394 B
C

#include "../includes/philo_header.h"
char *ft_strjoin(char const *s1, char const *s2)
{
int len1;
int len2;
char *new;
if (s1 && s2)
{
len1 = ft_strlen((char*)s1);
len2 = ft_strlen((char*)s2);
new = malloc(sizeof(char *) * len1 + len2 + 1);
if (new)
{
ft_strlcpy(new, s1, len1 + 1);
ft_strlcat(new, s2, len1 + len2 + 1);
return (void *)(new);
}
}
return (0);
}