Aktualizovat "program.c

This commit is contained in:
Michal Čabra 2019-10-11 09:20:10 +00:00
parent b6b1fe77f7
commit 7f03b44c66

View File

@ -132,15 +132,16 @@ 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){
//printf("Vraciam sa!");
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;
} }