为了账号安全,请及时绑定邮箱和手机立即绑定

如下情况如果没有,请教哪个慕友帮忙编个这样的函数!

如下情况如果没有,请教哪个慕友帮忙编个这样的函数!

C
www说 2022-12-08 17:13:38
Instr(n,s1,s2)返回在s1字符串中,从第n个字符开始,寻找s2字符,找到返回位置,找不到返回0(s2也可以是字符串(即字符数组);如果s2长度大于s1,也返回0)如Instr(2,"abcd","c")=3Instr(2,"abcd","cd")=3...
查看完整描述

2 回答

?
慕哥6287543

TA贡献1831条经验 获得超10个赞

当然有:
#include <string.h>
char *strstr(const char *haystack, const char *needle);

Return
It returns a pointer into the string haystack that is the first character of
the substring, or a null pointer if no match was found. If needle is an empty
string, the function returns haystack.

Description
This is like strchr() , except that it searches haystack for a substring
needle rather than just a single character.

顺便,如果你自己写不出这样的函数,不建议你继续学习C。

查看完整回答
反对 回复 2022-12-10
?
慕姐8265434

TA贡献1813条经验 获得超2个赞

没有,有这个函数 
char *strchr(cs, c)
return pointer to first occurrence of c in cs or NULL if not present

查看完整回答
反对 回复 2022-12-10
  • 2 回答
  • 0 关注
  • 107 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号