car
This commit is contained in:
parent
2c6b4d3778
commit
68a3b21ba9
@ -40,20 +40,21 @@ void print_train(struct car* first) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cancel_train(struct car* first) {
|
void cancel_train(struct car* first) {
|
||||||
if(first == NULL){
|
if(!first){
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if(first->value != NULL){
|
struct car* help = cancel_train(first->next);
|
||||||
struct car* help = first->next;
|
if(first->value != NULL){
|
||||||
|
first->next = help;
|
||||||
free(first);
|
free(first);
|
||||||
//first->next = NULL;
|
//cancel_train(help);
|
||||||
cancel_train(help);
|
|
||||||
//first->next = NULL;
|
//first->next = NULL;
|
||||||
}
|
}
|
||||||
else if(first->next == NULL){
|
//else if(first->next == NULL){
|
||||||
|
//free(first);
|
||||||
|
// cancel_train(first->next);
|
||||||
|
// }
|
||||||
free(first);
|
free(first);
|
||||||
cancel_train(first->next);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user