diff options
Diffstat (limited to 'maze/point.c')
-rw-r--r-- | maze/point.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/maze/point.c b/maze/point.c new file mode 100644 index 0000000..c83c80d --- /dev/null +++ b/maze/point.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <stdlib.h> +#include "data_structures.h" + +struct point *head; + +void +push(int x, int y, char c) +{ + struct point *tmp = malloc(sizeof(struct point)); + tmp->c = c; + tmp->x = x; + tmp->y = y; + tmp->next = head; + head = tmp; +} + +char +pop() +{ + if (head == NULL) { + return -1; + } + struct point *tmp = head; + char c = tmp->c; + head = head->next; + free(tmp); + return c; +} |