-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memccpy.c
More file actions
21 lines (19 loc) · 1.07 KB
/
ft_memccpy.c
File metadata and controls
21 lines (19 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memccpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tyassine <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/26 09:08:23 by tyassine #+# #+# */
/* Updated: 2015/12/08 00:02:35 by tyassine ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memccpy(void *s1, const void *s2, int c, size_t n)
{
while (n--)
if ((*(unsigned char*)s1++ = *(unsigned char*)s2++) == (unsigned char)c)
return (s1);
return (NULL);
}