How to show all elements in a stack

My code shows the elements, but after that, if i want to show the top, it crashes... but if after show all, i capture new element, now i can show the top... o_o

1
2
3
4
5
6
7
8
9
  void PilaDinamica::Print(){
    if(Vacia()){
        return;
    }
    pPersona x=Top();
    Pop();
    Print();
    PushPuntero(x);
 }


thanks
There doesn't appear to be anything wrong with that function. The error is being introduced in some other part of your code. (Maybe in PushPuntero()?)
Topic archived. No new replies allowed.