This commit is contained in:
Džubara 2024-10-24 19:02:50 +02:00
parent 1fe8245bf7
commit f7aaa7d7f8

View File

@ -1,7 +1,23 @@
#include <string.h>
#include <stdio.h>
#ifndef TRAIN_H #ifndef TRAIN_H
#define TRAIN_H #define TRAIN_H
#define SIZE 100 #define SIZE 100
/**
* Jeden vozen vlaku
*/
struct car {
/**
* Nazov cielovej stanice
*/
char value[SIZE];
/**
* Smenik na dalsi vozen
*/
struct car* next;
};
struct car* add_car(struct car* first, const char* target) { struct car* add_car(struct car* first, const char* target) {
// Vytvorenie noveho vozna // Vytvorenie noveho vozna
@ -29,15 +45,7 @@ struct car* add_car(struct car* first, const char* target) {
// Pridanie noveho vozna na koniec // Pridanie noveho vozna na koniec
temp->next = new_car; temp->next = new_car;
return first; return first;
}; }
/**
* Prida vozen na koniec vlaku.
*
* @arg nazov cielovej stanice, ktory sa ma priradit novemu voznu.
* @return smernik na zaciatok vlaku.
*/
struct car* add_car(struct car* first,const char* target);
/** /**