How to Serial print the entire x, y arrays using Stack Array library

My robot has to travel a maze. Maze is divided into cells, each cell defined by x,y coordinate. I want to print the stack array full of all the x values it has printed and another stack array of y values. The problem is I do not know what command will make it serial print the entire values in either the x o y stack array as the robot navigates through the maze so the array keeps getting bigger. Right now, it only prints the x, y values in the cell maze passes.

I am using following:

x_position.push(x);
y_position.push(y);
Serial.print(x_position.pop());
Serial.print(" x vector ");
Serial.print(y_position.pop());
Serial.print(" y vector ");

By logic, it is supposed to print only the value it got of the current cell. Can anyone let me know how to modify it to print all the x and y values in their respective arrays, namely x_position and y_position?

http://playground.arduino.cc/Code/StackArray

Can anyone let me know how to modify it to print all the x and y values in their respective arrays, namely x_position and y_position?

Using the library as-is, you can't, unless you are willing to destroy the stacks.

You could overload the peek() method, to let you peek at the nth item in the stack. You could add a method to print the whole stack.