-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strncpy.c
executable file
·25 lines (23 loc) · 1.05 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tseguier <tseguier@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2013/09/17 04:24:40 by tseguier #+# #+# */
/* Updated: 2014/07/02 16:01:10 by tseguier ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
char *ft_strncpy(char *s1, const char *s2, size_t n)
{
if (!s1 || !s2)
return (NULL);
while (n > 0)
{
--n;
*(s1 + n) = *(s2 + n);
}
return (s1);
}