diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-07-03 21:11:41 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-07-03 21:11:41 +0200 |
| commit | 5dfbcea1bc8b4d4fb3fca13b66a27f818b958b17 (patch) | |
| tree | ee895cdf94b42b16b01af698eae797a0b698032e /c02/ex01 | |
| parent | 3086fc662802db86395f439b9ab4ebc44358b5fa (diff) | |
| download | piscine-5dfbcea1bc8b4d4fb3fca13b66a27f818b958b17.tar.gz piscine-5dfbcea1bc8b4d4fb3fca13b66a27f818b958b17.tar.bz2 piscine-5dfbcea1bc8b4d4fb3fca13b66a27f818b958b17.zip | |
c02 start
Diffstat (limited to 'c02/ex01')
| -rw-r--r-- | c02/ex01/ft_strncpy.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/c02/ex01/ft_strncpy.c b/c02/ex01/ft_strncpy.c new file mode 100644 index 0000000..61bb451 --- /dev/null +++ b/c02/ex01/ft_strncpy.c @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strncpy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/03 19:02:31 by cacharle #+# #+# */ +/* Updated: 2019/07/03 19:36:32 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +char *ft_strncpy(char *dest, char *src, unsigned int n) +{ + int i; + + i = 0; + while (i < n || src[i] != '\0') + { + dest[i] = src[i]; + i++; + } + while (i < n) + { + dest[i] = '\0'; + i++; + } + return (dest); +} |
