From 30c39258d54472ec325024911eb9f77593315830 Mon Sep 17 00:00:00 2001 From: VIliam Date: Thu, 24 Oct 2024 19:10:30 +0200 Subject: [PATCH] 5 --- cv4/a_train.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cv4/a_train.c b/cv4/a_train.c index 5e59cc4..c7c4661 100644 --- a/cv4/a_train.c +++ b/cv4/a_train.c @@ -32,6 +32,16 @@ struct car* add_car(struct car* first, const char* target) { } void print_train(struct car* first) { + if (first == NULL) { + printf("Vlak je prazdny.\n"); + return; + } + + struct car* temp = first; + while (temp != NULL) { + printf("Cielova stanica: %s\n", temp->value); + temp = temp->next; + } } void cancel_train(struct car* first) {