/*
The strchr() and strrchr() functions return a pointer to the matched character or NULL
if the character is not found.
*/
char *strchr_r(const char *str, int c)
{
if(!str)
return NULL;
char ch = (char)c;
while((*str) && ((*str) != ch))
str++;
if((*str) == ch)
return (char *)str;
return NULL;
}
字符串 操作函数 strchr 实现
strchr_r与strrchr函数详解
最新推荐文章于 2024-07-03 14:41:27 发布
本文深入探讨了strchr_r和strrchr函数的功能、用法及实现细节,帮助开发者理解字符串搜索的基本原理。
2261

被折叠的 条评论
为什么被折叠?



