-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strjoin.c
More file actions
31 lines (29 loc) · 1.21 KB
/
ft_strjoin.c
File metadata and controls
31 lines (29 loc) · 1.21 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
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ybolivar <ybolivar@student.42madrid.c +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/21 15:43:32 by ybolivar #+# #+# */
/* Updated: 2022/04/08 15:18:51 by ybolivar ### ########.fr */
/* */
/* ************************************************************************** */
#include"libft.h"
char *ft_strjoin(char const *s1, char const *s2)
{
char *join;
char *send;
if (!s1 || !s2)
return (NULL);
join = (char *)malloc((ft_strlen(s1) + ft_strlen(s2) + 1) * sizeof(char));
if (!join)
return (NULL);
send = join;
while (*s1)
*join++ = *s1++;
while (*s2)
*join++ = *s2++;
*join = '\0';
return (send);
}