diff --git a/cv9/snake.c b/cv9/snake.c index 20d79f7..985cc10 100644 --- a/cv9/snake.c +++ b/cv9/snake.c @@ -18,16 +18,16 @@ struct snake* remove_snake(struct snake* snake){ return NULL; } - struct snake* prev = NULL; - struct snake* current = snake; - while (current->next != NULL) { - prev = current; - current = current->next; + struct snake* predtym = NULL; + struct snake* teraz = snake; + while (teraz->next != NULL) { + predtym = teraz; + teraz = teraz->next; } - free(current); - prev->next = NULL; - + free(teraz); + predtym->next = NULL; + return snake; }