blob: f8d0568f9b389037e5515e1438fe928ae30c6ae6 [file] [log] [blame]
#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;
}