clear
This commit is contained in:
parent
b6d8ebbf3c
commit
9d3a3489bb
@ -30,16 +30,6 @@ void print_train(struct car* first) {
|
||||
for(struct car* this = first; this != NULL; this = this->next){
|
||||
printf("%s\n", this->value);
|
||||
}
|
||||
/*struct car* this = first;
|
||||
if(first == NULL){
|
||||
exit(0);
|
||||
}
|
||||
else{
|
||||
while(this != NULL){
|
||||
printf("%s\n", this->value);
|
||||
this = this->next;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void cancel_train(struct car* first) {
|
||||
@ -52,10 +42,7 @@ void cancel_train(struct car* first) {
|
||||
}
|
||||
else if(first->next == NULL){
|
||||
free(first);
|
||||
// cancel_train(first->next);
|
||||
}
|
||||
//free(first);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -74,11 +61,11 @@ struct car* clear_train(struct car* first, const char* target) {
|
||||
}
|
||||
else{
|
||||
struct car* this = first;
|
||||
while(this != NULL){
|
||||
while(first != NULL){
|
||||
int x = strcmp(this->value, target);
|
||||
if(x == 0){
|
||||
struct car* temp = this->next;
|
||||
this->value = temp->value;
|
||||
strcpy(this->value,temp->value);
|
||||
free(temp);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user