-
Notifications
You must be signed in to change notification settings - Fork 2
/
ft_strncat.c
29 lines (26 loc) · 1.14 KB
/
ft_strncat.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mimeyer <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/19 11:56:05 by mimeyer #+# #+# */
/* Updated: 2019/06/11 12:51:56 by mimeyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncat(char *dest, const char *src, size_t n)
{
size_t dest_len;
size_t i;
i = 0;
dest_len = ft_strlen(dest);
while ((i < n) && (src[i] != '\0'))
{
dest[dest_len + i] = src[i];
i++;
}
dest[dest_len + i] = '\0';
return (dest);
}