【数据结构】字符串匹配

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

posted @ 2019-03-21 10:29  LiZR07  阅读(136)  评论(0编辑  收藏  举报