-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathft_strappfr.c
32 lines (29 loc) · 1.2 KB
/
ft_strappfr.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
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strappfr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: smonroe <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/08/09 15:12:56 by smonroe #+# #+# */
/* Updated: 2018/08/09 15:16:51 by smonroe ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strappfr(char *s1, char *s2)
{
char *new;
int len;
if (!s1 || !s2)
return (NULL);
len = ft_strlen(s1) + ft_strlen(s2);
if (!(new = ft_strnew(len)))
return (NULL);
if ((new = ft_strncat(new, s1, len)))
if ((new = ft_strncat(new, s2, len)))
{
free(s2);
return (new);
}
return (NULL);
}