clear
This commit is contained in:
parent
2b24ea0449
commit
2a624c76de
@ -33,20 +33,12 @@ void print_train(struct car* first) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cancel_train(struct car* first) {
|
void cancel_train(struct car* first) {
|
||||||
if(first == NULL){
|
if(first != NULL){
|
||||||
return;
|
cancel_train(first->next);
|
||||||
}
|
free(first);
|
||||||
if(first->next != NULL){
|
|
||||||
cancel_train(first->next);
|
|
||||||
first->next = NULL;
|
|
||||||
}
|
|
||||||
else if(first->next == NULL){
|
|
||||||
free(first);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct car* clear_train(struct car* first, const char* target) {
|
struct car* clear_train(struct car* first, const char* target) {
|
||||||
if(first == NULL){
|
if(first == NULL){
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user