39 lines
716 B
C
39 lines
716 B
C
#include "a_train.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
struct car* add_car(struct car* first,const char* target) {
|
|
struct car* newcar = calloc(1,sizeof(struct car));
|
|
newcar->next = NULL;
|
|
strcpy(newcar->value, target);
|
|
|
|
if(first == NULL){
|
|
return newcar;
|
|
}
|
|
|
|
struct car* this = first;
|
|
while(this->next != NULL){
|
|
this = this->next;
|
|
}
|
|
this->next = newcar;
|
|
|
|
return first;
|
|
}
|
|
|
|
void print_train(struct car* first) {
|
|
while(first != NULL){
|
|
printf("%s\n", first->value);
|
|
first = first->next;
|
|
}
|
|
}
|
|
|
|
void cancel_train(struct car* first) {
|
|
}
|
|
|
|
|
|
struct car* clear_train(struct car* first, const char* target) {
|
|
return NULL;
|
|
}
|
|
|