-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strncat.c
46 lines (42 loc) · 1.31 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: davgalle <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/19 14:16:59 by davgalle #+# #+# */
/* Updated: 2023/07/19 14:42:33 by davgalle ### ########.fr */
/* */
/* ************************************************************************** */
#include<string.h>
#include<stdio.h>
#include<unistd.h>
char *ft_strncat(char *dest, char *src, unsigned int nb)
{
unsigned int j;
unsigned int i;
i = 0;
while (dest[i] != '\0')
{
i++;
}
j = 0;
while (src[j] != '\0' && j < nb)
{
dest[i] = src[j];
j++;
i++;
}
dest[i] = '\0';
return (dest);
}
/*
int main(void)
{
char dest[]= "david";
char src[20]= "daniel";
ft_strncat(dest, src, 3);
printf("%s", dest);
return 0;
}*/