[Solved] Finding the first char in a string using pointers [closed]
[ad_1] You probably intended to do this: char* contains(const char* string, char c) { for (; *string; string++) { if (*string == c) { return string; } } return NULL; } Actually this boils more or less down to: char* contains(const char* string, char c) { return strchr(string, c); } Your contains function does the … Read more