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) {
|
||||
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){
|
||||
free(first);
|
||||
cancel_train(first->next);
|
||||
}
|
||||
//else if(first->next == NULL){
|
||||
//free(first);
|
||||
// cancel_train(first->next);
|
||||
// }
|
||||
free(first);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user