Aktualizovat "program.c

This commit is contained in:
Michal Čabra 2019-10-11 09:09:28 +00:00
parent 2abcb4a6f3
commit b6b1fe77f7

View File

@ -132,14 +132,15 @@ int search_string(const char* heap, const char* needle){
int j; int j;
/* For current index i, check for pattern match */ /* For current index i, check for pattern match */
for (j = 0; j <= D; j++){ for (j = 0; j <D; j++){
//printf("J=%d D=%d\n",j,D); //printf("J=%d D=%d\n",j,D);
if(j==D)return i;
//printf("%c %c\n",needle_2[i + j],heap[j]); //printf("%c %c\n",needle_2[i + j],heap[j]);
if (needle_2[i + j] != heap[j]) if (needle_2[i + j] != heap[j])
break; break;
} }
if(j==D)return i;
} }