ft_memchr
Subject
Understandable explanation
The memchr()
function works similarly as the strchr()
function, the difference is that memchr()
works with byte string (void *
) where strchr()
works with 'litteral' strings (char *
).
This means we can send whatever type of data we want to memchr()
and it'll still work.
memchr()
also has a third parameter, n
. This parameter tells the function how many bytes we want to search in. We need this parameter since s
is not a 'litteral' string, it doesn't have a NUL-terminating character. If we didn't have this parameter, we would be reading a random number of bytes each time.
Hints
ft_memchr.c
Commented solution
Last updated