From 7848af3fe68b9c0e7e0e97af0fb166aa0ce83870 Mon Sep 17 00:00:00 2001 From: Filip Chochol Date: Wed, 8 Apr 2026 16:14:38 +0200 Subject: [PATCH] push --- du5/program.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/du5/program.c b/du5/program.c index 243358a..42dd852 100644 --- a/du5/program.c +++ b/du5/program.c @@ -22,7 +22,7 @@ struct strom* nacitaj_strom() { struct strom* uzol = calloc(1, sizeof(struct strom)); memcpy(uzol->hodnota, buffer, SIZE); - if (buffer[0] == '*') { + if (buffer[0] != '*') { uzol->ano = nacitaj_strom(); uzol->nie = nacitaj_strom(); } @@ -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 1; + if (uzol->ano == NULL && uzol->nie == NULL) return 0; return spocitaj_listy(uzol->ano) + spocitaj_listy(uzol->nie); } @@ -61,9 +61,9 @@ void spusti_system(struct strom* uzol) { } if (odpoved[0] == 'a') { - spusti_system(uzol->ano); - } else if (odpoved[0] == 'n') { spusti_system(uzol->nie); + } else if (odpoved[0] == 'n') { + spusti_system(uzol->ano); } else { printf("Chybny vstup.\n"); }