From 3ec3997cd652d128f6b5fd57e3f0783faf115208 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Mon, 2 Nov 2020 11:44:42 +0100 Subject: [PATCH] delete --- cv5/a_train.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index e865b4d..41ea869 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -32,27 +32,28 @@ void print_train(struct car* first) { } void cancel_train(struct car* first) { - struct car* this; + //struct car* this; if(first == NULL){ exit(0); } - else if(first->next == NULL){ + if(first->next == NULL){ //this = first; //first = first->next; free(first); - first = NULL; + //first = NULL; } else{ - struct car* prev = first; + /*struct car* prev = first; while(prev->next->next != NULL){ prev = prev->next; } this = prev->next; prev->next = NULL; - free(this); + free(this);*/ + + cancel_train(first->next); + free(first); } - //cancel_train(first->next); - //free(first); }