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
| #include <stdlib.h>
| #include <stdio.h>
| #include "bin-trees.h"
|
| tree_ptr
| pop (struct stack_struct **stack)
| {
| if (*stack == NULL)
| return NULL;
| else
| {
| tree_ptr value = (*stack)->data;
| (*stack) = (*stack)->next;
| return value;
| }
| }
|
| void
| push (struct stack_struct **stack, tree_ptr value)
| {
| struct stack_struct *new_node = (struct stack_struct *) malloc (sizeof (struct stack_struct *));
| new_node->data = value;
| new_node->next = *stack;
| *stack = new_node;
| }
|
|