From fdde562ecfed2d438f2dfd24930e394e70ed3829 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Mon, 2 Nov 2020 11:42:12 +0100 Subject: [PATCH] print --- cv5/a_train.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index d98daa3..e865b4d 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -20,11 +20,10 @@ struct car* add_car(struct car* first,const char* target) { void print_train(struct car* first) { struct car* this = first; - /*if(first == NULL){ + if(first == NULL){ exit(0); - }*/ - //else{ - if(first != NULL){ + } + else{ while(this != NULL){ printf("%s\n", this->value); this = this->next; @@ -38,9 +37,9 @@ void cancel_train(struct car* first) { exit(0); } else if(first->next == NULL){ - this = first; - first = first->next; - free(this); + //this = first; + //first = first->next; + free(first); first = NULL; } else{