This commit is contained in:
Bohdan Kapliuk 2024-11-14 14:37:42 +02:00
parent 4a23ba9b26
commit b640c1eb0e

View File

@ -15,12 +15,10 @@ struct tree* read_tree(int* counter) {
memset(buffer, 0, SIZE);
char* r = fgets(buffer, SIZE, stdin);
if(r == NULL){
printf("Expert z bufetu to vie.\n");
printf("Chybna databaza\n");
return NULL;
return 0;
}
if (buffer[0] == '\n') {
return NULL;
return 0;
}
struct tree* tree = calloc(1, sizeof(struct tree));
tree->value = malloc(strlen(buffer) + 1);
@ -71,6 +69,9 @@ int main() {
printf("Pozna %d druhov ovocia a zeleniny.\n", counter);
printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n");
print_tree(root);
} else{
printf("Expert z bufetu to vie.\n");
printf("Chybna databaza\n");
}
destroy_tree(root);
return 0;