diff --git a/du5/a_station.c b/du5/a_station.c index 2796913..1b400cc 100644 --- a/du5/a_station.c +++ b/du5/a_station.c @@ -41,11 +41,16 @@ void add_target_capacity(struct station* station,const char* target, int capacit } if(count < res){ - struct car* next = (struct car*)calloc(10, sizeof(struct car)); + struct car* next = (struct car*)calloc(1, sizeof(struct car)); strcpy(next->value, target); next->capacity = capacity; + if(ptr){ ptr->next = next; - return; + return;} + else{ + *station->tracks = next; + return; + } } ptr->capacity += capacity;