From 710956e0df8ad38aaf14132dadaadc4cf27f2488 Mon Sep 17 00:00:00 2001 From: Michal Utlak Date: Tue, 9 Apr 2024 16:36:36 +0200 Subject: [PATCH] hlavicka --- cv9/snake.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cv9/snake.c b/cv9/snake.c index 7038cdb..98c45c0 100644 --- a/cv9/snake.c +++ b/cv9/snake.c @@ -2,7 +2,17 @@ #include struct snake* add_snake(struct snake* snake,int x,int y){ - return NULL; + struct snake* hlavicka = (struct snake*)malloc(sizeof(struct snake)); + if (hlavicka == NULL) { + return NULL; + } + + hlavicka->x = x; + hlavicka->y = y; + + hlavicka->next = snake; + + return hlavicka; } struct snake* remove_snake(struct snake* snake){