Изменил(а) на 'du7/snake.c'

This commit is contained in:
Vladyslav Korzun 2023-04-20 06:16:10 +00:00
parent de56e6f91c
commit bdb6a9b609

View File

@ -10,20 +10,18 @@ struct snake* add_snake(struct snake* snake, int x, int y) {
}
struct snake* remove_snake(struct snake* snake) {
struct snake* prev = NULL;
struct snake* curr = snake;
while (curr->next != NULL) {
prev = curr;
curr = curr->next;
}
free(curr);
if (prev != NULL) {
prev->next = NULL;
return snake;
} else {
return NULL;
}
struct snake* this = head;
this = this->next;
while (this->next != NULL){
this = this->next;
}
this = head;
while (this != NULL){
// Niečo môžme s prvkom this spraviť
this= this->next;
}
}
void free_snake(struct snake* sn) {
while (sn != NULL) {