cv4
This commit is contained in:
parent
240e43d609
commit
51e095e6c0
@ -2,13 +2,28 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
struct car* add_car(struct car* first,const char* target) {
|
struct car* add_car(struct car* first,const char* target) {
|
||||||
return NULL;
|
struct car* newcar = calloc(1,sizeof(struct car));
|
||||||
|
strcpy(newcar->value, target);
|
||||||
|
struct car* this = first;
|
||||||
|
while (this->next != NULL) {
|
||||||
|
this = this->next;
|
||||||
|
}
|
||||||
|
this->next = newcar;
|
||||||
|
return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_train(struct car* first) {
|
void print_train(struct car* first) {
|
||||||
|
while(first != NULL)(
|
||||||
|
printf("%s", first->value);
|
||||||
|
first->value = first->next
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
void cancel_train(struct car* first) {
|
void cancel_train(struct car* first) {
|
||||||
|
while(first != NULL){
|
||||||
|
free(first->next);
|
||||||
|
first = first->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user