С здесь .
Возвращает указатель на первое вхождение символа в строку C строки.
Завершающий нулевой символ считается частью строки C. Следовательно, он также может быть расположен для получения указателя на конец строки.
/* strchr example */
#include <stdio.h>
#include <string.h>
int main ()
{
char str[] = "This is a sample string";
char * pch;
printf ("Looking for the 's' character in \"%s\"...\n",str);
pch=strchr(str,'s');
while (pch!=NULL)
{
printf ("found at %d\n",pch-str+1);
pch=strchr(pch+1,'s');
}
return 0;
}
будет выдавать
Looking for the 's' character in "This is a sample string"...
found at 4
found at 7
found at 11
found at 18