查找子字符串,并记录查找的第一个子字符串的位置

code: https://github.com/lujinjianst/myNCCL/blob/master/exercise/exercise-12.3.c

 

computational results

 

[haoyue@centos exercise]$ ./a.out
input string s1 and s2:
hello
helloworld
helloworld is not  in hello
[haoyue@centos exercise]$ ./a.out
input string s1 and s2:
world hello
hello
hello is in world hello  ,the first position 6
[haoyue@centos exercise]$ ./a.out
input string s1 and s2:
helloworldhello
hello
hello is in helloworldhello ,the first position 0

 

以上程序存在一些弊端,大家可以进一步研究。。。


你可能感兴趣的:(C语言集锦之小项目)