tgrekov-libft
HIVE libft Oct 2023
Loading...
Searching...
No Matches
ft_memchr.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_memchr.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2023/10/24 17:31:16 by tgrekov #+# #+# */
9
/* Updated: 2023/11/04 22:46:42 by tgrekov ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
20
#include "
libft.h
"
21
33
void
*
ft_memchr
(
const
void
*s,
int
c,
size_t
n)
34
{
35
size_t
i;
36
37
i = 0;
38
while
(i < n)
39
{
40
if
(((
unsigned
char
*) s)[i] == (
unsigned
char
) c)
41
return
((
void
*)(s + i));
42
i++;
43
}
44
return
(0);
45
}
ft_memchr
void * ft_memchr(const void *s, int c, size_t n)
Finds first occurence of c in byte string at s within n bytes.
Definition
ft_memchr.c:33
libft.h
ft_memchr.c