This commit is contained in:
Bohdan Kapliuk 2024-10-15 14:38:26 +03:00
parent 51e095e6c0
commit 67305af891

View File

@ -1,5 +1,7 @@
#include "a_train.h" #include "a_train.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct car* add_car(struct car* first,const char* target) { struct car* add_car(struct car* first,const char* target) {
struct car* newcar = calloc(1,sizeof(struct car)); struct car* newcar = calloc(1,sizeof(struct car));
@ -13,10 +15,10 @@ struct car* add_car(struct car* first,const char* target) {
} }
void print_train(struct car* first) { void print_train(struct car* first) {
while(first != NULL)( while(first != NULL){
printf("%s", first->value); printf("%s", first->value);
first->value = first->next first = first->next;
) }
} }
void cancel_train(struct car* first) { void cancel_train(struct car* first) {