Life is Good.

Enhance Tech and English
随笔 - 65, 文章 - 20, 评论 - 21, 引用 - 0
数据加载中……

9 - strchr

/***
*char *strchr(string, c) - search a string for a character
*
*Purpose:
*       Searches a string for a given character, which may be the
*       null character '\0'.
*
*Entry:
*       char *string - string to search in
*       char c - character to search for
*
*Exit:
*       returns pointer to the first occurence of c in string
*       returns NULL if c does not occur in string
*
*Exceptions:
*
******************************************************************************
*/

char * __cdecl strchr (
        
const char * string,
        
int ch
        )
{
        
while (*string && *string != (char)ch)
                
string++;

        
if (*string == (char)ch)
                
return((char *)string);
        
return(NULL);
}

posted on 2011-06-11 21:11 Mike Song 阅读(204) 评论(0)  编辑 收藏 引用 所属分类: C字符串函数源码分析


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理