Изменить 'du7/snake.c'

This commit is contained in:
Oleksandr Hryshchenko 2021-04-27 17:44:30 +00:00
parent 0463e59800
commit cd786b6e1c

View File

@ -29,7 +29,11 @@ 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){
struct snake* temp = snake; struct snake* temp = snake;
if(snake == NULL || snake->next == NULL){ if(snake == NULL){
return snake;
}
else if(snake->next == NULL){
free(snake);
return snake; return snake;
} }