#include <stdio.h> #include <string.h> int main () { char str[] = "This is a line"; char *p; printf ("Looking for 's' character in \"%s\"...\n", str); p = strchr(str, 's'); while (p != NULL) { printf ("found at %d\n",p - str + 1); p = strchr(p + 1, 's'); } return 0; }