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
| DOS | UNIX | Windows | ANSI C | C++ 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
strcspnstrchr#include<string.h>#include<stdio.h>intmain{charstring[15]*ptrc='r';strcpy;ptr=strrchr;ifprintf;elseprintf;return0;}
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`
Stable link: /3.1/string.h/strrchr/
· short form /3.1/strrchr/