From 33861f4a21fe4a8246bb0e4c2c8977221c215dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Vasi=C4=BE?= Date: Tue, 26 Apr 2022 20:26:09 +0200 Subject: [PATCH] domaca_uloha_7 --- du7/snake.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/du7/snake.c b/du7/snake.c index 7c9c139..0b08096 100644 --- a/du7/snake.c +++ b/du7/snake.c @@ -16,14 +16,15 @@ struct snake* add_snake(struct snake* snake,int x,int y){ } 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); return nasledujuci; } void free_snake(struct snake* sn){ - struct snake* nasledujuci; + struct snake* nasledujuci = calloc(1, sizeof(struct snake)); while (sn != NULL) { nasledujuci = sn->next;