This commit is contained in:
Michal Utľák 2024-04-09 16:59:38 +02:00
parent f8ad054518
commit af6540d032

View File

@ -13,13 +13,16 @@ struct snake* add_snake(struct snake* snake,int x,int y){
} }
struct snake* remove_snake(struct snake* snake){ struct snake* remove_snake(struct snake* snake){
if (snake == NULL) { if (snake == NULL) {
return NULL; return NULL;
} }
struct snake* nova_hlavicka = snake->next; struct snake* nova_hlavicka = snake->next;
free(snake); free(snake);
assert(nova_hlavicka == NULL || nova_hlavicka->next == NULL);
return nova_hlavicka; return nova_hlavicka;
} }