-1
void *ft_memchr(const void *s, int c, size_t n)
{
while (n > 0)
{
if (*(unsigned char *) s == c)
{
return ((void *)s);
}
s++;
n--;
}
return (NULL);
}
What would this be *(unsigned char *)s
?
I understand it’s a cast because it’s a void
and such, but what I can’t understand and can’t find material to understand is these pointers, for example the first *
I no longer know what it is, but from what I’ve seen its existence it already leaves me totally in doubt of the existence of the second pointer.
This might help: https://answall.com/q/70843/112052 | https://answall.com/q/90855/112052 | https://answall.com/q/266831/112052
– hkotsubo
This answers your question? What is the purpose of the void in C?
– Augusto Vasques