totn C Functions

C Language: strrchr function
(Search String in Reverse for Character)

In the C Programming Language, the strrchr function searches within the string pointed to by s for the last occurrence of the character c. It returns a pointer to it.

Syntax

The syntax for the strrchr function in the C Language is:

char *strrchr(const char *s, int c);

Parameters or Arguments

s
A string (terminated by a null character).
c
The character to be found.

Returns

The strrchr function returns a pointer to the last occurrence of the character c within the string pointed to by s. If c isn't found, it returns a null pointer.

Required Header

In the C Language, the required header for the strrchr function is:

#include <string.h>

Applies To

In the C Language, the strrchr function can be used in the following versions:

  • ANSI/ISO 9899-1990

See Also

Other C functions that are noteworthy when dealing with the strrchr function: