UtilLib
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strjoin.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hexplor <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/16 12:21:11 by hexplor #+# #+# */
|
||||
/* Updated: 2023/11/30 08:49:26 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
char *ft_strjoin(char const *s1, char const *s2)
|
||||
{
|
||||
size_t len;
|
||||
char *str;
|
||||
|
||||
len = ft_strlen(s1);
|
||||
len += ft_strlen(s2);
|
||||
str = (char *)ft_calloc((len + 1), 1);
|
||||
if (!str)
|
||||
return (NULL);
|
||||
ft_memmove(str, s1, ft_strlen(s1));
|
||||
ft_memmove((str + ft_strlen(s1)), s2, ft_strlen(s2));
|
||||
return (str);
|
||||
}
|
||||
Reference in New Issue
Block a user