diff options
Diffstat (limited to 'ft_strjoin.c')
| -rw-r--r-- | ft_strjoin.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ft_strjoin.c b/ft_strjoin.c new file mode 100644 index 0000000..3befb18 --- /dev/null +++ b/ft_strjoin.c @@ -0,0 +1,13 @@ +#include <stdlib.h> +#include "libft.h" + +char * ft_strjoin(char const *s1, char const *s2) +{ + char *joined; + + if ((joined = (char*)malloc(sizeof(char) * (ft_strlen(s1) + ft_strlen(s2) + 1))) + == NULL) + return (NULL); + joined = ft_strcpy(joined, s1); + return (ft_strcat(joined, s2)); +} |
