mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 23:14:06 +08:00
39 lines
744 B
HTML
39 lines
744 B
HTML
<h1>字符串函数 - strchr</h1>
|
||
|
||
|
||
<p>原型:extern char *strchr(char *s,char c);</p>
|
||
|
||
<p>用法:#include <string.h></p>
|
||
|
||
<p>功能:查找字符串s中首次出现字符c的位置</p>
|
||
|
||
<p>说明:返回首次出现c的位置的指针,如果s中不存在c则返回NULL。</p>
|
||
|
||
举例:<pre>
|
||
|
||
|
||
// strchr.c
|
||
|
||
#include <syslib.h>
|
||
#include <string.h>
|
||
|
||
main()
|
||
{
|
||
char *s="Golden Global View";
|
||
char *p;
|
||
|
||
clrscr();
|
||
|
||
strchr(s,'V');
|
||
if(p)
|
||
printf("%s",p);
|
||
else
|
||
printf("Not Found!");
|
||
|
||
getchar();
|
||
return 0;
|
||
}
|
||
|
||
</pre>相关函数:<a href="memchr.html">memchr</a>
|
||
|