diff --git a/a5/program.c b/a5/program.c index 106d327..a52efcd 100644 --- a/a5/program.c +++ b/a5/program.c @@ -65,7 +65,10 @@ void search(struct morsetree* root, char* decode){ printf("\n"); return; }*/ - if(decode[i+1] == ' ' || decode[i+1] == '\n' || decode[i+1] == '\0'){ + if(decode[i] == ' ' || decode[i] == '\n' || decode[i] == '\0'){ + if(i == strlen(decode)){ + return; + } printf("%c", this->letter); this = root; }