I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
ComputingCString.h

strpbrk

Locate multiple characters in string
+ View other versions (3)

Interface

#include <string.h>
char strpbrk (const char *s, const char *charset)

Description

The strpbrk function locates in the null-terminated string s the first occurrence of any character in the string charset and returns a pointer to this character. If no characters from charset occur anywhere in s strpbrk returns NULL.

Example:
Example - Locate multiple characters in string
Workings
#include <stdio.h>
#include <string.h>
int main()
{
  char s[20] = "abcde1010101", t[3] = "01";
  printf("The position of the first binary digit of s is: %d.\n", strpbrk(s, t) - s);
  return 0;
}
Solution
Output:
The position of the first binary digit of s is: 5.

Standards

The strpbrk function conforms to ISO/IEC 9899:1990 ("ISO C90").