Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1335585
  • 博文数量: 166
  • 博客积分: 46
  • 博客等级: 民兵
  • 技术积分: 4061
  • 用 户 组: 普通用户
  • 注册时间: 2013-01-11 13:45
个人简介

现任职北京某互联网公司运维经理,高级架构师,涉足互联网运维行业已经超过10年。曾服务于京东商城,互动百科等互联网公司,早期运维界新星。 长期专研,C语言开发,操作系统内核,大型互联网架构。http://www.bdkyr.com

文章分类

分类: 系统运维

2015-07-31 10:19:39

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

#include<string.h>

查找字符串s中首次出现字符c的位置,返回首次出现c的位置的指针,如果s中不存在c则返回NULL

The strchr function finds the first occurrence of c instr, or it returns NULL ifc is not found. The null terminating character is included in the search.

实例讲解:

[root@bdkyr xuekun]# vim strchr_test.c

/*
 * create by xuekun
 * date 2015-7-31
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

main()
{
    char *s="Golden Global View";
    char *p;
    p=strchr(s,'V');
    if(p)
        printf("%s\n",p);
    else
        printf("Not Found!\n");
    return 0;
}

[root@bdkyr xuekun]# gcc strchr_test.c -o strchr_test
[root@gateway xuekun]# ./strchr_test    
View

阅读(7509) | 评论(0) | 转发(3) |
给主人留下些什么吧!~~