-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strjoin.c
27 lines (24 loc) · 1.18 KB
/
ft_strjoin.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mschumac <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/06/13 00:45:08 by mschumac #+# #+# */
/* Updated: 2017/06/13 00:50:09 by mschumac ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strjoin(char const *s1, char const *s2)
{
char *new_string;
if (s1 == NULL || s2 == NULL)
return (NULL);
new_string = ft_strnew(ft_strlen(s1) + ft_strlen(s2) + 1);
if (new_string == NULL)
return (NULL);
ft_strcpy(new_string, s1);
ft_strcat(new_string, s2);
return (new_string);
}