关于函数strchr();

原型:extern char *strchr(const char *s,char c);

 

  const char *strchr(const char* _Str,int _Val)

 

  char *strchr(char* _Str,int _Ch)

 

  头文件:#include <string.h>

 

  功能:查找字符串s中首次出现字符c的位置

 

  说明:返回首次出现c的位置的指针,如果s中不存在c则返回NULL。

 

  返回值:Returns the address of the first occurrence of the character in the string if successful, or NULL otherwise

例子:

#include<iostream>

#include<string.h>

using namespace std;

int main()

{  char a[10],b,*p,c;

 cin>>a;

 p=strchr(a,'b');    

printf("%s\n",p);  

return 0; }

原文地址:https://www.cnblogs.com/xiohao/p/2709763.html