-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathft_strcat.c
39 lines (35 loc) · 1.37 KB
/
ft_strcat.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
29
30
31
32
33
34
35
36
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apuchill <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/12/03 10:21:00 by apuchill #+# #+# */
/* Updated: 2020/10/30 19:57:09 by apuchill ### ########.fr */
/* */
/* ************************************************************************** */
/*
** LIBRARY: <string.h>
** SYNOPSIS: concatenate strings (s2 into s1)
**
** DESCRIPTION:
** The strcat() and strncat() functions append a copy of the null-
** terminated string s2 to the end of the null-terminated string s1, then
** add a terminating `\0'. The string s1 must have sufficient space to hold
** the result.
*/
#include "libft.h"
char *ft_strcat(char *s1, const char *s2)
{
int i;
i = ft_strlen(s1);
while (*s2 != '\0')
{
s1[i] = *s2;
i++;
s2++;
}
s1[i] = '\0';
return (s1);
}