add
This commit is contained in:
parent
3caa2bbe73
commit
6eef97b6ce
@ -7,9 +7,8 @@
|
|||||||
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));
|
||||||
if(target == NULL){
|
if(target == NULL){
|
||||||
exit(0);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(newcar->value, target);
|
strcpy(newcar->value, target);
|
||||||
|
|
||||||
if(first == NULL){
|
if(first == NULL){
|
||||||
@ -47,7 +46,7 @@ void cancel_train(struct car* first) {
|
|||||||
cancel_train(first->next);
|
cancel_train(first->next);
|
||||||
first->next = NULL;
|
first->next = NULL;
|
||||||
}
|
}
|
||||||
if(first->next == NULL){
|
else if(first->next == NULL){
|
||||||
free(first);
|
free(first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user