在大小写敏感的前提下,用C语言编写函数计算子字符串substr在主字符串mainstr中的索引值。
如果substr完全包含在mainstr中,请计算出索引值。否则,返回-1.
具体代码如下:
findstr.c