57%
This commit is contained in:
parent
0d7e32d2b7
commit
75787c17f9
@ -27,29 +27,26 @@ struct car* add_car(struct car* first,const char* target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void print_train(struct car* first) {
|
void print_train(struct car* first) {
|
||||||
if(first!=NULL){
|
|
||||||
struct car* this=first;
|
struct car* this=first;
|
||||||
while(this->next!=NULL){
|
while(this->next!=NULL){
|
||||||
printf("%s",this->value);
|
printf("%s",this->value);
|
||||||
this=this->next;
|
this=this->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void cancel_train(struct car* first) {
|
void cancel_train(struct car* first) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct car* clear_train(struct car* first, const char* target) {
|
struct car* clear_train(struct car* first, const char* target) {
|
||||||
struct car* prev = first;
|
struct car* prev = first;
|
||||||
//Už sme si istí, že prev a prev->next nie sú NULL
|
//Už sme si istí, že prev a prev->next nie sú NULL
|
||||||
// while (prev->next->next != NULL){
|
while (prev->next->next != NULL){
|
||||||
// prev = prev->next;
|
prev = prev->next;
|
||||||
//}
|
}
|
||||||
//struct car* third = prev->next->next;
|
struct car* third = prev->next->next;
|
||||||
//free(prev->next);
|
free(prev->next);
|
||||||
//prev->next = third;
|
prev->next = third;
|
||||||
//return first;
|
return first;
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user