-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strncat.c
27 lines (24 loc) · 1.07 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: luiroel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/05 21:08:05 by luiroel #+# #+# */
/* Updated: 2020/02/26 21:17:43 by luiroel ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncat(char *s1, const char *s2, size_t n)
{
char *str;
str = s1 + ft_strlen(s1);
while (*s2 != '\0' && n)
{
*str++ = *s2++;
n--;
}
*str = '\0';
return (s1);
}