diff options
author | Michael Hunteman <michael@huntm.net> | 2023-09-23 12:53:46 -0500 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2023-10-21 21:48:03 -0500 |
commit | 9891f38ddcca971fa21ab61e7a70832c8c877b0a (patch) | |
tree | 1e820435b42c5c8187bb6d17b3ff1c204c933c1a /maze/point.c |
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; +} |