This commit is contained in:
Maryna Kravtsova 2020-11-02 15:06:15 +01:00
parent 2c6b4d3778
commit 68a3b21ba9

View File

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