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) {
if(!first){
return NULL;
if(first == NULL){
return;
}
struct car* help = cancel_train(first->next);
if(first->value != NULL){
first->next = help;
free(first);
//cancel_train(help);
//first->next = NULL;
if(first->next != NULL){
cancel_train(first->next);
first->next = NULL;
}
//else if(first->next == NULL){
//free(first);