The signature of strchr
is
char* strchr(char* string, int elem);
This means the string should be first and the element second. When you write
strchr(Intermediary[i], "y")
You're passing a char
as the first parameter and a char *
as a second parameter. This will result in the code definitely not doing what you think it does.
Did you mean to write
strchr(Intermediary + i, 'y')
which means "search the string Intermediary
, offset by i
steps, for the character y
?
Hope this helps!