add
This commit is contained in:
parent
33dc166873
commit
da2607343b
@ -6,15 +6,16 @@
|
||||
#include "a_train.h"
|
||||
|
||||
struct car* add_car(struct car* first,const char* target) {
|
||||
struct car* newcar = calloc(1, sizeof(struct car));
|
||||
if(target == NULL){
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
strcpy(newcar->value, target);
|
||||
|
||||
if(first == NULL){
|
||||
return newcar;
|
||||
}
|
||||
|
||||
struct car* newcar = calloc(1, sizeof(struct car));
|
||||
strcpy(newcar->value, target);
|
||||
|
||||
struct car *this = first;
|
||||
while(this->next != NULL){
|
||||
this = this->next;
|
||||
|
Loading…
Reference in New Issue
Block a user