标签:
strrchr
char *ho_strrchr(const char *s, int c) { const char *p; unsigned char cc = c; for (p = s; *p; p++); while (s <= p) { if (*p == cc) return (char *)p; p--; } return NULL; } int main() { printf("%s\n", ho_strrchr("123456789", ‘1‘)); printf("%s\n", ho_strrchr("123456789", ‘2‘)); printf("%s\n", ho_strrchr("123456789", ‘3‘)); printf("%s\n", ho_strrchr("123456789", ‘9‘)); printf("%s\n", ho_strrchr("123456789", ‘a‘)); printf("%s\n", ho_strrchr("123123", ‘1‘)); return 0; }
标签:
原文地址:http://my.oschina.net/guonaihong/blog/403509