-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_memccpy.c
30 lines (27 loc) · 1.2 KB
/
ft_memccpy.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
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_memccpy.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: cgarrot <[email protected]> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/10/06 09:22:43 by cgarrot #+# ## ## #+# */
/* Updated: 2018/10/07 04:20:18 by cgarrot ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
void *ft_memccpy(void *dst,
const void *src, int c, size_t n)
{
unsigned char *d;
const unsigned char *s;
unsigned char i;
d = dst;
s = src;
i = c;
while (n--)
if ((*d++ = *s++) == i)
return (d);
return (NULL);
}