【数据结构】字符串匹配

#include<stdio.h>
#include<stdlib.h>
int main() {
char str[] = "helloworld" , *q , *p , strlx[] = "11111hell1111111helloworld12121" ;
p = str;
q = strlx;
for ( ; *p != '' ; q++ , p++)
{
if ( *p != *q )
p = str ;
if( *q == '') {
printf("cha zhao shi bai");
break;
}
}
if(*p == '')
printf("cha zhao cheng gong");
}

原文地址:https://www.cnblogs.com/duolaAbao/p/10487555.html