Изменил(а) на 'du7/snake.c'
This commit is contained in:
parent
de56e6f91c
commit
bdb6a9b609
24
du7/snake.c
24
du7/snake.c
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user