-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strncat.c
28 lines (25 loc) · 1.1 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ibohonos <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/10/25 10:41:57 by ibohonos #+# #+# */
/* Updated: 2017/11/06 18:00:07 by ibohonos ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncat(char *dest, const char *src, size_t n)
{
size_t i;
int l;
i = 0;
l = 0;
while (dest[l] != '\0')
l++;
while (i < n && src[i] != '\0')
dest[l++] = src[i++];
dest[l] = '\0';
return (dest);
}