Added function to move cards between stacks.

This commit is contained in:
Murilo Soares Pereira 2010-04-09 00:49:17 -03:00
parent c744581711
commit 18cf795914
2 changed files with 10 additions and 0 deletions

View File

@ -73,3 +73,12 @@ struct stack *pop(struct stack **stack) {
return(popped_entry); return(popped_entry);
} }
void move_card(struct stack **origin, struct stack **destination) {
struct stack *stack = NULL;
stack = pop(origin);
push(destination, stack->card);
return;
}

View File

@ -15,5 +15,6 @@ bool empty(struct stack *);
int length(struct stack *); int length(struct stack *);
void push(struct stack **, struct card *); void push(struct stack **, struct card *);
struct stack *pop(struct stack **); struct stack *pop(struct stack **);
void move_card(struct stack **, struct stack **);
#endif #endif