-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_memccpy.c
executable file
Β·29 lines (26 loc) Β· 1.15 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memccpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: selchoi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/12/26 17:53:00 by selchoi #+# #+# */
/* Updated: 2021/01/12 00:35:22 by selchoi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memccpy(void *dst, const void *src, int c, size_t n)
{
unsigned char *tmp;
tmp = (unsigned char *)dst;
while (n--)
{
*tmp = *(unsigned char *)src;
++tmp;
if (*(unsigned char *)src == (unsigned char)c)
return (tmp);
++src;
}
return (NULL);
}