variables

This commit is contained in:
Michal Utľák 2024-04-09 17:29:13 +02:00
parent df7d0ccd00
commit 69eaba6642

View File

@ -18,15 +18,15 @@ 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;
}