-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strjoin.c
More file actions
27 lines (24 loc) · 1.16 KB
/
ft_strjoin.c
File metadata and controls
27 lines (24 loc) · 1.16 KB
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: lmartine <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/03/03 18:34:42 by lmartine #+# #+# */
/* Updated: 2018/03/10 22:26:38 by lmartine ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strjoin(char const *s1, char const *s2)
{
char *temp;
if (!s1 || !s2)
return (NULL);
if (!(temp = (char *)malloc(ft_strlen((char *)s1) +
ft_strlen((char *)s2) + 1)))
return (NULL);
temp = ft_strcpy(temp, s1);
temp = ft_strcat(temp, s2);
return (temp);
}