clear
This commit is contained in:
parent
535859a615
commit
a8b4648778
@ -80,16 +80,14 @@ struct car* clear_train(struct car* first, const char* target) {
|
||||
|
||||
else{
|
||||
struct car* this = first;
|
||||
while(this != NULL){
|
||||
while(this->next != NULL){
|
||||
//while(this != NULL){
|
||||
int x = strcmp(this->value, target);
|
||||
int x = strcmp(this->next->value, target);
|
||||
if(x == 0){
|
||||
first = this->next;
|
||||
free(this);
|
||||
struct car* temp = this->next->next;
|
||||
this->next = NULL;
|
||||
//free(this->next);
|
||||
|
||||
return first;
|
||||
this->next = temp;
|
||||
return this;
|
||||
}
|
||||
this = this->next;
|
||||
//}
|
||||
|
Loading…
Reference in New Issue
Block a user