读书人

查寻子字符串并记录查找的第一个子字

发布时间: 2013-01-02 13:08:44 作者: rapoo

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

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

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


读书人网 >其他相关

热点推荐