From 90b8a98abd7110fd87b167abf9b2142c9c52da62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Vasi=C4=BE?= Date: Tue, 26 Apr 2022 19:44:26 +0200 Subject: [PATCH] domaca_uloha_7 --- du7/snake.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/du7/snake.c b/du7/snake.c index 0e263fb..9fbdebf 100644 --- a/du7/snake.c +++ b/du7/snake.c @@ -2,12 +2,13 @@ #include struct snake* add_snake(struct snake* snake,int x,int y){ - if (snake == NULL) return NULL; - struct snake* novyZaciatok; novyZaciatok->x = x; novyZaciatok->y = y; - snake->next = novyZaciatok; + + if (snake != NULL) { + snake->next = novyZaciatok; + } return novyZaciatok; }