-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strncpy.c
executable file
·31 lines (29 loc) · 1.12 KB
/
ft_strncpy.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cfranco <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/01/16 12:46:04 by cfranco #+# #+# */
/* Updated: 2018/01/16 12:46:17 by cfranco ### ########.fr */
/* */
/* ************************************************************************** */
char *ft_strncpy(char *dest, char *src, unsigned int n)
{
unsigned int c;
unsigned int c2;
c = 0;
c2 = 0;
while (src[c2] != '\0')
c2++;
while (c < n)
{
if (c > c2)
dest[c] = '\0';
else
dest[c] = src[c];
c++;
}
return (dest);
}