train2
This commit is contained in:
parent
7be122a19c
commit
96151e5e3b
@ -16,7 +16,6 @@ struct car* add_car(struct car* first,const char* target) {
|
||||
}
|
||||
this->next = newcar;
|
||||
return first;
|
||||
|
||||
}
|
||||
|
||||
void print_train(struct car* first) {
|
||||
@ -32,18 +31,15 @@ void print_train(struct car* first) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cancel_train(struct car* first) {
|
||||
struct car *this = first->next;
|
||||
if(first == NULL){
|
||||
exit(0);
|
||||
}
|
||||
if(first->next == NULL){
|
||||
struct car *this = first;
|
||||
first = first->next;
|
||||
free(this);
|
||||
exit(0);
|
||||
if(first->value == NULL){
|
||||
free(first);
|
||||
}
|
||||
cancel_train(first->next);
|
||||
cancel_train(this->next);
|
||||
free(first);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user