Answers for "print stack from bottom to top"

C++
0

print stack from bottom to top

void PrintStack(stack<int> s)
{
    if (s.empty())
        return;
    int x = s.top();
    s.pop();
    PrintStack(s);
    cout << x << " ";
    s.push(x);
}
Posted by: Guest on April-08-2021

Browse Popular Code Answers by Language