字符串函数 - strchr

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

用法:#include <string.h>

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

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

举例:



      // 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;
      }
      
  
相关函数:memchr