// strpbrk example // locate characters in string // source: http://www.cplusplus.com/ #include #include #include int main () { char str[] = "This is a sample string"; char key[] = "aeiou"; char *pch; printf ("Vowels found in '%s' using strpbrk (string pointer break) are: ",str); pch = strpbrk(str, key); while (pch != NULL) { printf ("%c " , *pch); // we keep moving along the string pch = strpbrk (pch+1,key); } printf ("\n"); return EXIT_SUCCESS; }