blob: f8b33391c6e484699c3c4fecce052f345b732b17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <string.h>
char *strchr(const char *s, int c) {
do {
if ((char)c == *s)
return (char*)s;
} while (*s++ != '\0');
return NULL;
}
char *strrchr(const char *s, int c)
{
const char *last = NULL;
do {
if (*s == (char)c)
last = s;
} while (*s++);
return (char *)last;
}
|