-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strcat.c
35 lines (32 loc) · 1.23 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jkwayiba <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/22 14:23:23 by jkwayiba #+# #+# */
/* Updated: 2019/06/24 23:39:46 by jkwayiba ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strcat(char *dest, const char *src)
{
int dest_len;
int src_len;
int i;
dest_len = 0;
src_len = 0;
i = 0;
while (dest[dest_len] != '\0')
dest_len++;
while (src[src_len] != '\0')
src_len++;
while ((i < src_len) && (src[i] != '\0'))
{
dest[dest_len + i] = src[i];
i++;
}
dest[dest_len + i] = '\0';
return (dest);
}