Table of Contents
This guide covers the function strpbrk ()() in c with practical context and easy-to-follow details. Use it to understand the subject and apply the information confidently.
Declaring the Strpbrk ()() Function in C
Below is the declaration for strpbrk () in C:
char * strpbrk ( const char * str1 , const char * str2 )
Parameters
Str1 - Is a string to be scanned.
Str2 - String containing characters to be matched.
Returns the Value
This function returns a pointer to the character in str1 that connects (matches) to one of str2's characters, or returns NULL if no such character is found.
For Example
The following C program illustrates the usage of strpbrk () in C:
#include #include int main () { const char str1 [] = "abcde2fghi3jk4l" ; const char str2 [] = "34" ; char * ret ; ret = strpbrk ( str1 , str2 ); if ( ret ) { printf ( "Ky tu ket noi dau tien: %cn" , * ret ); } else { printf ( "Khong tim thay ky tu" ); } return ( 0 ); }
Compiling and running the above C program will result:
According to Tutorialspoint
Previous article: strlen () function in C
Next lesson: Strrchr () function in C
FAQ
What should I check before following these steps?
Confirm device and software compatibility, save important data, and make sure you have the required permissions, files, and account access.
Why might the process not work?
Common causes include outdated software, missing permissions, incompatible hardware, an unstable connection, or completing a step in the wrong order.
Can I undo the changes if necessary?
That depends on the tool or setting. Use built-in restore options when available, keep a backup, and record the original configuration first.
Reader Comments 0
Sign in with email or Google to join the discussion.