strrchr() — Find Last Occurrence of Character in String

Format

#include <string.h>

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

General Description

The strrchr() function finds the last occurrence of c (converted to a char) in string. The ending NULL character is considered part of the string.

Returned Value

If successful, strrchr() returns a pointer to the last occurrence of c in string.

If the given character is not found, strrchr() returns a NULL pointer.

Related Information