Compare commits

..

No commits in common. "1fe8245bf75496cd05d18b1862331d0a3a770380" and "a83e11a5176d69dc80bc82bfbcbe18086b5ad6d0" have entirely different histories.

View File

@ -2,33 +2,18 @@
#define TRAIN_H #define TRAIN_H
#define SIZE 100 #define SIZE 100
/**
struct car* add_car(struct car* first, const char* target) { * Jeden vozen vlaku
// Vytvorenie noveho vozna */
struct car* new_car = (struct car*)malloc(sizeof(struct car)); struct car {
if (new_car == NULL) { /**
printf("Chyba: Nepodarilo sa alokovať pamäť pre nový vozeň.\n"); * Nazov cielovej stanice
return first; */
} char value[SIZE];
/**
// Inicializacia hodnot * Smenik na dalsi vozen
strncpy(new_car->value, target, SIZE); */
new_car->next = NULL; struct car* next;
// Ak vlak neexistuje, novy vozen sa stane prvym
if (first == NULL) {
return new_car;
}
// Najdenie posledneho vozna
struct car* temp = first;
while (temp->next != NULL) {
temp = temp->next;
}
// Pridanie noveho vozna na koniec
temp->next = new_car;
return first;
}; };
/** /**