blob: 3bbb41f3cc534461a0dcb7a23888e2d7e7fd7fc3 (
plain)
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
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:28:37 by cacharle #+# #+# */
/* Updated: 2019/10/07 10:30:53 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
char *ft_strncat(char *dest, const char *src, size_t n)
{
size_t i;
size_t j;
i = 0;
while (dest[i])
i++;
j = 0;
while (j < n && src[j])
{
dest[i + j] = src[j];
j++;
}
dest[i + j] = '\0';
return (dest);
}
|