C 函数Strstr()的用法

字符串查找操作。

#include<string.h>

main(){
  char * s="012d345678dd1d23";
  char *p;
  p=strstr(s,"123");
  # 如果找不到就会返回0
  if(p!=0){
    printf("%s\n",p);
  }else{
    printf("%s\n","没找到");
  }

}

 

posted @ 2013-08-01 23:19  墨迹哥's  阅读(828)  评论(0编辑  收藏  举报