views:

133

answers:

1

Given a stack that displays characters to the screen First in First Out(FIFO), how do you switch it to display them Last in First Out(LIFO). Theoretically speaking... is it simply just sending the characters to print in reverse order?

+1  A: 

Keep length of stack, then walk along it from head to tail. You will have queue effect. But it will work only if your stack is a whole array (not linked list)

Andrey