memchr函数
函数原型:extern void *memchr(void *str, char ch, unsigned count)
#include<string.h>
#include<stdio.h>
int main()
{
char *str="Hello,I am sky2098,I liking programing!";
char character='k' ; //指定一个字符
void *voidtemp;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
voidtemp=memchr(str,character,strlen("Hello,I am sky2098,I liking programing!"));
if(voidtemp!=NULL)
{
printf("Search Success!/n ");
}
else
{
printf("Search Failure!/n ");
}
return 0;
}
参数说明:从str所指内存区域的前count个字节查找字符ch。
所在库名:#include <string.h>
函数功能:当第一次遇到字符ch时停止查找。如果成功,返回指向字符ch的指针;否则返回NULL。
返回说明:返回void*类型指针(或者NULL)。
其它说明:暂时无。
实例:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
在VC++ 6.0 编译运行:
Keep it simple!