clear
This commit is contained in:
parent
3ff32fafa1
commit
97472d25cf
@ -64,11 +64,16 @@ struct car* clear_train(struct car* first, const char* target) {
|
|||||||
while(first != NULL){
|
while(first != NULL){
|
||||||
int x = strcmp(this->value, target);
|
int x = strcmp(this->value, target);
|
||||||
if(x == 0){
|
if(x == 0){
|
||||||
struct car* temp = this->next;
|
struct car* prev = this;
|
||||||
strcpy(this->value,temp->value);
|
struct car* node = this->next;
|
||||||
free(temp);
|
while(prev != NULL && node != NULL){
|
||||||
free(temp->value);
|
prev->next = node->next;
|
||||||
return 0;
|
free(node);
|
||||||
|
prev = prev->next;
|
||||||
|
if(prev != NULL){
|
||||||
|
node = prev->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this = this->next;
|
this = this->next;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user