|
|
@ -15,16 +15,20 @@ struct snake* remove_snake(struct snake* snake){ |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
struct snake* curent_element = snake; |
|
|
|
struct snake* previous_element; |
|
|
|
while(curent_element->next != NULL){ |
|
|
|
previous_element=curent_element; |
|
|
|
curent_element = curent_element->next; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
free(curent_element); |
|
|
|
|
|
|
|
|
|
|
|
if(curent_element==snake){ |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
|
|
|
|
previous_element->next=NULL; |
|
|
|
|
|
|
|
return snake; |
|
|
|
} |
|
|
|
|
|
|
|