Borland C++ reference

strrchr, _fstrrchr

raw OCR

Scans a string for the last occurrence of a given character.

Defined in header <string.h>

Syntax

#include <string.h>
Near  version: char  *strrchr(const  char *s, int c);
Far version: char  far * far _fstrrchr(const  char far *s, int c)

Portability

DOSUNIXWindowsANSI CC++ only
Near version ■■■■
■■

Remarks

strrchr scans a string in the reverse direction, looking for a specific character, strrchr finds the last occurrence of the character c in the string s. The null-terminator is considered to be part of the string.

Return value

strrchr returns a pointer to the last occurrence of the character c. If c does not occur in s, strrchr returns null.

See also

  • strcspn
  • strchr
  • #include
  • <string.h>
  • #include
  • <stdio.h>
  • int
  • main
  • {
  • char
  • string[15]
  • *ptr
  • c
  • =
  • 'r';
  • strcpy;
  • ptr
  • =
  • strrchr;
  • if
  • printf;
  • else
  • printf;
  • return
  • 0;
  • }

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.

Extraction notes

  • heading `strrchr, fstrrchr` read as `strrchr, _fstrrchr`