-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strncat.c
32 lines (29 loc) · 1.17 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
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bwebb <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/23 10:46:40 by bwebb #+# #+# */
/* Updated: 2019/05/30 11:58:52 by bwebb ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncat(char *dest, const char *src, size_t n)
{
int i;
int j;
char *dst;
const char *sorc;
i = 0;
dst = dest;
sorc = src;
while (dst[i] != '\0')
i++;
j = 0;
while ((sorc[j] != '\0') && (j != (int)n))
dst[i++] = sorc[j++];
dst[i] = '\0';
return (dest);
}