variables
This commit is contained in:
parent
df7d0ccd00
commit
69eaba6642
14
cv9/snake.c
14
cv9/snake.c
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user