delete
This commit is contained in:
parent
fdde562ecf
commit
3ec3997cd6
@ -32,27 +32,28 @@ void print_train(struct car* first) {
|
||||
}
|
||||
|
||||
void cancel_train(struct car* first) {
|
||||
struct car* this;
|
||||
//struct car* this;
|
||||
if(first == NULL){
|
||||
exit(0);
|
||||
}
|
||||
else if(first->next == NULL){
|
||||
if(first->next == NULL){
|
||||
//this = first;
|
||||
//first = first->next;
|
||||
free(first);
|
||||
first = NULL;
|
||||
//first = NULL;
|
||||
}
|
||||
else{
|
||||
struct car* prev = first;
|
||||
/*struct car* prev = first;
|
||||
while(prev->next->next != NULL){
|
||||
prev = prev->next;
|
||||
}
|
||||
this = prev->next;
|
||||
prev->next = NULL;
|
||||
free(this);
|
||||
free(this);*/
|
||||
|
||||
cancel_train(first->next);
|
||||
free(first);
|
||||
}
|
||||
//cancel_train(first->next);
|
||||
//free(first);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user