This commit is contained in:
Andrii Hermaniuk 2022-04-29 11:46:14 +02:00
parent 70975ce682
commit 6e8079aba0

View File

@ -15,9 +15,12 @@ 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->next&&!snake) if(!snake)
return NULL; return NULL;
if(!snake->next){
free(snake);
return NULL;
}
struct snake* last = snake; struct snake* last = snake;
struct snake* secondLast = snake; struct snake* secondLast = snake;