Added pop() and function prototypes.

This commit is contained in:
Murilo Soares Pereira 2010-04-03 22:12:42 -03:00
parent 1c65ae3672
commit f0aa621e69
2 changed files with 18 additions and 0 deletions

View File

@ -43,3 +43,15 @@ void push(struct stack *stack, struct card *card) {
stack = new_stack;
}
}
struct stack *pop(struct stack *stack) {
struct stack *popped_entry = NULL;
if(!empty(stack)) {
popped_entry = stack;
popped_entry = NULL;
stack = stack->next;
}
return(popped_entry);
}

View File

@ -6,4 +6,10 @@ struct stack {
struct stack *next;
};
struct stack *initialize_stack();
bool empty(struct stack *);
int length(struct stack *);
void push(struct stack *, struct card *);
struct stack *pop(struct stack *);
#endif