domaca_uloha_7

This commit is contained in:
Tomáš Vasiľ 2022-04-26 20:26:09 +02:00
parent ce45e519a5
commit 33861f4a21

View File

@ -16,14 +16,15 @@ 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* nasledujuci = snake->next; struct snake* nasledujuci = calloc(1, sizeof(struct snake));
nasledujuci = snake->next;
free(snake); free(snake);
return nasledujuci; return nasledujuci;
} }
void free_snake(struct snake* sn){ void free_snake(struct snake* sn){
struct snake* nasledujuci; struct snake* nasledujuci = calloc(1, sizeof(struct snake));
while (sn != NULL) { while (sn != NULL) {
nasledujuci = sn->next; nasledujuci = sn->next;