문자열매칭 기본적인 질문이요 ㅜㅜ
살랑살랑
질문 제목 : 왜 출력이 11밖에 안될까요?? ㅜㅜ #include stdio.h
#include string.h
int stringmatch(char *str, char *pat){
int i,j,start_s=0;
int s = strlen(str);
int p = strlen(pat);
for(i=0;is;i++)
{
for(j=0, start_s=i;jp && str[start_s]==pat[j]; start_s++, j++);
if(j==p)
return i;
}
return -1;
}
int main(int argc, char* argv[]){
char str[] = all of the threads of a process share the same address space and other resources, such as open files. any alteration of a resource by one thread affects the environment of the other threads in the same process. ;
char pat[] = threads;
int matched_index;
matched_index = stringmatch(str,pat);
if(matched_index -1)
printf(maching index is %d\n, matched_index);
else
printf(no maching pattern\n);
}질문 내용 : threads랑 매칭이 시작되는 주소가 11인건 알겠는데요 그 뒤에 또 threads가있는데 이거 출력되는 방법이
알고 싶습니다..코드좀 알려주세요 ㅜㅜ