Compare commits
No commits in common. "32d35323f9a3aaff46c05eeb67edde5d40711f4e" and "6f4ea44c71441e88f269fc28e2b18ba0ffc7ec8f" have entirely different histories.
32d35323f9
...
6f4ea44c71
14
cv9/snake.c
14
cv9/snake.c
@ -3,6 +3,9 @@
|
||||
|
||||
struct snake* add_snake(struct snake* snake,int x,int y){
|
||||
struct snake* hlavicka = calloc(1,sizeof(struct snake));
|
||||
if (hlavicka == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hlavicka->x = x;
|
||||
hlavicka->y = y;
|
||||
@ -13,18 +16,7 @@ struct snake* add_snake(struct snake* snake,int x,int y){
|
||||
}
|
||||
|
||||
struct snake* remove_snake(struct snake* snake){
|
||||
if (snake == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct snake* nova_hlavicka = snake->next;
|
||||
free(snake);
|
||||
|
||||
if (nova_hlavicka != NULL) {
|
||||
nova_hlavicka->next = NULL;
|
||||
}
|
||||
|
||||
return nova_hlavicka;
|
||||
}
|
||||
|
||||
void free_snake(struct snake* sn){
|
||||
|
Loading…
Reference in New Issue
Block a user