Table of Contents
This guide covers the strchr ()() function in c with practical context and easy-to-follow details. Use it to understand the subject and apply the information confidently.
Declare the Strchr ()() Function in C
Below is the declaration for strchr () in C:
char * strchr ( const char * str , int c )
Parameters
Str - This is the string to be scanned.
c - This is the character to be searched in str.
Returns the Value
This function returns a pointer to the first occurrence of the c character in the str string, or returns NULL if the character is not found.
For Example
The following C program illustrates the usage of strchr () in C:
#include #include int main () { const char str [] = "https://QTM.com/lap-trinh-c/index.jsp" ; const char ch = '.' ; char * ret ; ret = strchr ( str , ch ); printf ( "Chuoi dang sau dau |%c| la: n|%s|n" , ch , ret ); return ( 0 ); }
Compiling and running the above C program will result:
According to Tutorialspoint
Previous article: Strncat () function in C
Next article: Function strcmp () 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.