blob: c83c80dbf837127bc7b1b3a42d61e17c191137a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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;
}
|