13 lines
185 B
C
13 lines
185 B
C
|
#include <string.h>
|
||
|
|
||
|
void *memrchr(void const *_s, int c, size_t n)
|
||
|
{
|
||
|
char const *s = _s;
|
||
|
|
||
|
for(int i = n - 1; i >= 0; i--) {
|
||
|
if(s[i] == c) return (char *)&s[i];
|
||
|
}
|
||
|
|
||
|
return NULL;
|
||
|
}
|