From 53cca3553b37a28f736c075708d70d8976a3fb92 Mon Sep 17 00:00:00 2001 From: Filip Chochol Date: Wed, 8 Apr 2026 16:17:49 +0200 Subject: [PATCH] push --- du5/program.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/du5/program.c b/du5/program.c index 42dd852..7fc26f7 100644 --- a/du5/program.c +++ b/du5/program.c @@ -39,7 +39,7 @@ void znic_strom(struct strom* uzol) { int spocitaj_listy(struct strom* uzol) { if (uzol == NULL) return 0; - if (uzol->ano == NULL && uzol->nie == NULL) return 0; + if (uzol->ano == NULL && uzol->nie == NULL) return 1; return spocitaj_listy(uzol->ano) + spocitaj_listy(uzol->nie); } @@ -61,17 +61,24 @@ void spusti_system(struct strom* uzol) { } if (odpoved[0] == 'a') { - spusti_system(uzol->nie); - } else if (odpoved[0] == 'n') { spusti_system(uzol->ano); + } else if (odpoved[0] == 'n') { + spusti_system(uzol->nie); } else { printf("Chybny vstup.\n"); } } int main() { + struct strom* koren = nacitaj_strom(); + if (koren) { + printf("koren: %s", koren->hodnota); + printf("ano: %s", koren->ano ? koren->ano->hodnota : "NULL\n"); + printf("nie: %s", koren->nie ? koren->nie->hodnota : "NULL\n"); + } + if (koren == NULL) { printf("Chyba: nepodarilo sa nacitat bazu pravidiel.\n"); return 1;