diff --git a/du6/program.c b/du6/program.c index e28fc0b..22cd704 100644 --- a/du6/program.c +++ b/du6/program.c @@ -97,12 +97,12 @@ int main(void){ printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost."); while(tree){ printf("\n%s", tree->value); - fgets(answer, sizeof(answer), stdin); - answer[strcspn(answer, "\n")] = '\0'; - if(answer[0] == '\0'){ + if( fgets(answer, sizeof(answer), stdin)){ printf("\nKoniec vstupu\n"); return 0; + } + answer[strcspn(answer, "\n")] = '\0'; if(strcmp(answer, "n") == 0){ tree = tree->right;