-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strjoin.c
27 lines (24 loc) · 1.13 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: rodrodri <[email protected] > +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/30 14:41:03 by rodrodri #+# #+# */
/* Updated: 2021/11/14 23:13:24 by rodrodri ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strjoin(char const *s1, char const *s2)
{
char *join;
if (!s1 || !s2)
return (NULL);
join = ft_strnew(ft_strlen(s1) + ft_strlen(s2));
if (!join)
return (NULL);
ft_strcpy(join, s1);
ft_strcat(join, s2);
return (join);
}