You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
494 B
26 lines
494 B
#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;
|
|
}
|