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) {