clear
This commit is contained in:
parent
3983947573
commit
c73cf75196
@ -52,21 +52,14 @@ struct car* clear_train(struct car* first, const char* target) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(first->next == NULL){
|
||||
int result = strcmp(first->value, target);
|
||||
if(result == 0){
|
||||
free(first);
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
return first;
|
||||
}
|
||||
}
|
||||
|
||||
struct car* prev = first;
|
||||
while(prev->next != NULL){
|
||||
int x = strcmp(first->value, target);
|
||||
if(x == 0){
|
||||
if(first->next == NULL){
|
||||
free(first);
|
||||
return NULL:
|
||||
}
|
||||
prev = first->next;
|
||||
free(first);
|
||||
return prev;
|
||||
|
Loading…
Reference in New Issue
Block a user