-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strjoin.c
30 lines (27 loc) · 1.15 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
28
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: alukyane <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/10/24 19:51:30 by alukyane #+# #+# */
/* Updated: 2017/10/24 19:51:32 by alukyane ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strjoin(char const *s1, char const *s2)
{
char *str;
if (s1 || s2)
{
str = ft_memalloc(ft_strlen(s1) + ft_strlen(s2) + 1);
if (str == 0)
return (NULL);
if (s1)
ft_strcpy(str, s1);
ft_strcat(str, s2);
return (str);
}
return (NULL);
}