From 244f5209ba7885daa513e3780b66df454422b910 Mon Sep 17 00:00:00 2001 From: Cabergs Charles Date: Sat, 6 Jul 2019 08:42:30 +0200 Subject: c03 and begin c04 --- c03/ex03/ft_strncat.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 c03/ex03/ft_strncat.c (limited to 'c03/ex03') diff --git a/c03/ex03/ft_strncat.c b/c03/ex03/ft_strncat.c new file mode 100644 index 0000000..c28fb38 --- /dev/null +++ b/c03/ex03/ft_strncat.c @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strncat.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/05 13:02:04 by cacharle #+# #+# */ +/* Updated: 2019/07/05 15:33:07 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +char *ft_strncat(char *dest, char *src, unsigned int nb) +{ + unsigned int i; + char *dest_end; + + i = 0; + while (dest[i] != '\0') + i++; + dest_end = dest + i; + i = 0; + while (i < nb && src[i] != '\0') + { + dest_end[i] = src[i]; + i++; + } + return (dest); +} -- cgit