Table of Contents
This guide covers the strrchr ()() function in c with practical context and easy-to-follow details. Use it to understand the subject and apply the information confidently.
Declaring Strrchr ()() Function in C
Here is the declaration for strrchr () in C:
char * strrchr ( const char * str , int c )
Parameters
Str - A string.
c - This is the character to be located. It is transmitted in int form, but internally it is converted back to char.
Returns the Value
This function returns a pointer to the last occurrence of the character in str. If the value is not found, the function returns a null pointer.
For Example
The following C program illustrates the usage of strrchr () in C:
#include #include int main () { int len ; const char str [] = "https://QTM.com/lap-trinh-c/index.jsp" ; const char ch = '.' ; char * ret ; ret = strrchr ( str , ch ); printf ( "Chuoi xuat hien sau dau |%c| cuoi cung la: n|%s|n" , ch , ret ); return ( 0 ); }
Compiling and running the above C program will result:
According to Tutorialspoint
Previous article: Function strpbrk () in C
Next lesson: strspn () 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.