-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strjoin.c
More file actions
29 lines (26 loc) · 1.2 KB
/
Copy pathft_strjoin.c
File metadata and controls
29 lines (26 loc) · 1.2 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tsargsya <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/09 16:01:23 by tsargsya #+# #+# */
/* Updated: 2024/12/12 15:45:42 by tsargsya ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
char *ft_strjoin(char const *s1, char const *s2)
{
size_t total_len;
char *res;
total_len = ft_strlen(s1) + ft_strlen(s2);
res = malloc(total_len + 1);
if (!res)
return (NULL);
res[0] = '\0';
ft_strlcat(res, s1, total_len + 1);
ft_strlcat(res, s2, total_len + 1);
return (res);
}