-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strcat.c
41 lines (37 loc) · 1.34 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
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: luiroel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/05 15:17:45 by luiroel #+# #+# */
/* Updated: 2020/02/26 21:17:43 by luiroel ### ########.fr */
/* */
/* ************************************************************************** */
/*
** Create pointer to start of s1, so we don't
** lose track of the adress where the string starts
** then increase the pointer and make the value of
** each address equal to the source str
** set the value of our last address equal to
** a null term. Return s1
*/
#include "libft.h"
char *ft_strcat(char *s1, const char *s2)
{
char *str;
str = s1;
while (*s1 != '\0')
{
s1++;
}
while (*s2 != '\0')
{
*s1 = *s2;
s1++;
s2++;
}
*s1 = '\0';
return (str);
}