VOOZH about

URL: https://www.geeksforgeeks.org/c/strpbrk-in-c/

⇱ strpbrk() in C - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

strpbrk() in C

Last Updated : 18 Sep, 2023
This function finds the first character in the string s1 that matches any character specified in s2 (It excludes terminating null-characters).
Syntax : 
char *strpbrk(const char *s1, const char *s2)

Parameters :
s1 : string to be scanned.
s2 : string containing the characters to match.

Return Value :
It returns a pointer to the character in s1 that 
matches one of the characters in s2, else returns NULL.
Output:
Character not found
First matching character: e

Practical Application This function can be used in game of lottery where the person having string with letter coming first in victory wins, i.e. this can be used at any place where first person wins.
Output:
Better luck next time
Congrats u have won

Comment
Article Tags: