domaca_uloha_7

This commit is contained in:
Tomáš Vasiľ 2022-04-26 19:44:26 +02:00
parent 2e2720ce15
commit 90b8a98abd

View File

@ -2,12 +2,13 @@
#include <stdlib.h> #include <stdlib.h>
struct snake* add_snake(struct snake* snake,int x,int y){ struct snake* add_snake(struct snake* snake,int x,int y){
if (snake == NULL) return NULL;
struct snake* novyZaciatok; struct snake* novyZaciatok;
novyZaciatok->x = x; novyZaciatok->x = x;
novyZaciatok->y = y; novyZaciatok->y = y;
snake->next = novyZaciatok;
if (snake != NULL) {
snake->next = novyZaciatok;
}
return novyZaciatok; return novyZaciatok;
} }