Write the function my_strchr(). The function has two parameters: a const char * s pointing to the first character in a C-style string, and a char c. Return a pointer to the first appearance of c appearing inside s and NULL (0) if c does not appear inside s.
Is there something wrong with this code? It doesn't return any output when i test it with the string "adabadoo" and char 'a'
const char * my_strchr(const char * s, char c)
{
for(int i = 0; i < strlen(s); i++)
{
if(*s == c) return s;
else return '\0';
s++;
}
}