-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strjoin.c
More file actions
31 lines (28 loc) · 1.16 KB
/
ft_strjoin.c
File metadata and controls
31 lines (28 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
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: algungor <algungor@student.42istanbul.com.t+#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/19 14:48:36 by algungor #+# #+# */
/* Updated: 2026/01/19 15:11:58 by algungor ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strjoin(char const *s1, char const *s2)
{
size_t i;
size_t x;
size_t ts;
char *ptr;
i = ft_strlen(s1);
x = ft_strlen(s2);
ts = i + x;
ptr = malloc(ts + 1);
if (!ptr)
return (NULL);
ft_memcpy(ptr, s1, i);
ft_memcpy(ptr + i, s2, x + 1);
return (ptr);
}