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.

Note: When COMPACT is specified, the compiler does not generate inline code for this function. In this case, you need to take either of the following actions:
  • Define the __METAL_SYSVEC feature test macro to use the system library.
  • Define the __METAL_STATIC feature test macro to use the static object library and bind in corresponding data set.

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.