pls
This commit is contained in:
parent
8b6ffcb16b
commit
78f05087c6
11
cv9/snake.c
11
cv9/snake.c
@ -18,22 +18,17 @@ struct snake* remove_snake(struct snake* snake){
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct snake* nova_hlavicka = snake->next;
|
struct snake* nova_hlavicka = snake->next;
|
||||||
|
|
||||||
free(snake);
|
free(snake);
|
||||||
|
|
||||||
|
if (nova_hlavicka == NULL) {
|
||||||
if (nova_hlavicka == NULL || nova_hlavicka->next == NULL) {
|
return NULL;
|
||||||
assert(nova_hlavicka == NULL || nova_hlavicka->next == NULL);
|
|
||||||
return nova_hlavicka;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct snake* chvost = nova_hlavicka;
|
struct snake* chvost = nova_hlavicka;
|
||||||
while (chvost->next != NULL) {
|
while (chvost->next != NULL) {
|
||||||
chvost = chvost->next;
|
chvost = chvost->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(chvost->next == NULL);
|
assert(chvost->next == NULL);
|
||||||
|
|
||||||
return nova_hlavicka;
|
return nova_hlavicka;
|
||||||
|
Loading…
Reference in New Issue
Block a user