Keil Logo


#include <string.h>

unsigned char *strrchr (
  const unsigned char *string,   /* string to search */
  char c);                       /* character to find */

The strrchr function searches string for the last occurrence of c. The null character terminating string is included in the search.

Return Value

The strrchr function returns a pointer to the last character c found in string or a null pointer if no matching character was found.

See Also

strchr, strcspn, strpbrk, strpos, strrpbrk, strrpos, strspn

#include <string.h>
#include <stdio.h> /* for printf */

void tst_strrchr (void) {
  unsigned char *s;
  unsigned char buf [] = "This is a test";

  s = strrchr (buf, 't');

  if (s != NULL)
    printf ("found the last 't' at %s\n", s);
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.