Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Data Structure & Algorithm/strpbrk.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// C code to demonstrate the working of
// strpbrk
#include <stdio.h>
#include <string.h>

// Driver function
int main()
{
// Declaring three strings
char s1[] = "geeksforgeeks";
char s2[] = "app";
char s3[] = "kite";
char* r, *t;

// Checks for matching character
// no match found
r = strpbrk(s1, s2);
if (r != 0)
printf("First matching character: %c\n", *r);
else
printf("Character not found");

// Checks for matching character
// first match found at "e"
t = strpbrk(s1, s3);
if (t != 0)
printf("\nFirst matching character: %c\n", *t);
else
printf("Character not found");

return (0);
}