print stack from bottom to top

Solutions on MaxInterview for print stack from bottom to top by the best coders in the world

showing results for - "print stack from bottom to top"
Roberta
03 Oct 2016
1void PrintStack(stack<int> s)
2{
3    if (s.empty())
4        return;
5    int x = s.top();
6    s.pop();
7    PrintStack(s);
8    cout << x << " ";
9    s.push(x);
10}