-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strjoin.c
executable file
·28 lines (25 loc) · 1.19 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: luperez <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/15 21:24:20 by luperez #+# #+# */
/* Updated: 2014/11/17 10:40:29 by luperez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strjoin(char const *s1, char const *s2)
{
char *s;
size_t len;
if (s1 == NULL || s2 == NULL)
return (NULL);
len = ft_strlen(s1) + ft_strlen(s2);
s = (char *)malloc(sizeof(char) * (len + 1));
ft_bzero(s, len + 1);
s = ft_strcat(s, (char *)s1);
s = ft_strcat(s, (char *)s2);
return (s);
}