1 #include <stdlib.h> 2 #include <stdio.h> 3 #include "bin-trees.h" 4 5 tree_ptr pop(struct stack_struct ** stack)6pop (struct stack_struct **stack) 7 { 8 if (*stack == NULL) 9 return NULL; 10 else 11 { 12 tree_ptr value = (*stack)->data; 13 (*stack) = (*stack)->next; 14 return value; 15 } 16 } 17 18 void push(struct stack_struct ** stack,tree_ptr value)19push (struct stack_struct **stack, tree_ptr value) 20 { 21 struct stack_struct *new_node = (struct stack_struct *) malloc (sizeof (struct stack_struct *)); 22 new_node->data = value; 23 new_node->next = *stack; 24 *stack = new_node; 25 } 26