16 lines
251 B
C
16 lines
251 B
C
#include <string.h>
|
|
|
|
char *strrchr(const char *s, int c)
|
|
{
|
|
/* include null term */
|
|
long sz = strlen(s) + 1;
|
|
|
|
for (long i = sz; i >= 0; i--) {
|
|
if (s[i] == c) {
|
|
return (char *)(s + i);
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|