This commit is contained in:
Maryna Kravtsova 2020-11-02 15:10:26 +01:00
parent 68a3b21ba9
commit 79d7a7636d

View File

@ -40,15 +40,12 @@ void print_train(struct car* first) {
} }
void cancel_train(struct car* first) { void cancel_train(struct car* first) {
if(!first){ if(first == NULL){
return NULL; return;
} }
struct car* help = cancel_train(first->next); if(first->next != NULL){
if(first->value != NULL){ cancel_train(first->next);
first->next = help; first->next = NULL;
free(first);
//cancel_train(help);
//first->next = NULL;
} }
//else if(first->next == NULL){ //else if(first->next == NULL){
//free(first); //free(first);