clear
This commit is contained in:
parent
194849ce29
commit
b6d8ebbf3c
@ -1,5 +1,4 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -78,10 +77,9 @@ struct car* clear_train(struct car* first, const char* target) {
|
|||||||
while(this != NULL){
|
while(this != NULL){
|
||||||
int x = strcmp(this->value, target);
|
int x = strcmp(this->value, target);
|
||||||
if(x == 0){
|
if(x == 0){
|
||||||
this->value = this->next->value;
|
struct car* temp = this->next;
|
||||||
struct car* third = this->next;
|
this->value = temp->value;
|
||||||
this->next = third->next;
|
free(temp);
|
||||||
free(third);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
this = this->next;
|
this = this->next;
|
||||||
|
Loading…
Reference in New Issue
Block a user