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

Instr(n,s1,s2)返回在s1字符串中,从第n个字符开始,寻找s2字符,找到返回位置,找不到返回0(s2也可以是字符串(即字符数组);如果s2长度大于s1,也返回0)
如Instr(2,"abcd","c")=3
Instr(2,"abcd","cd")=3
...

www说
浏览 108回答 2
2回答

慕哥6287543

当然有:#include <string.h>char *strstr(const char *haystack, const char *needle);ReturnIt returns a pointer into the string haystack that is the first character ofthe substring, or a null pointer if no match was found. If needle is an emptystring, the function returns haystack.DescriptionThis is like strchr() , except that it searches haystack for a substringneedle rather than just a single character.顺便,如果你自己写不出这样的函数,不建议你继续学习C。

慕姐8265434

没有,有这个函数&nbsp;char *strchr(cs, c)return pointer to first occurrence of c in cs or NULL if not present
打开App,查看更多内容
随时随地看视频慕课网APP