stack erase 1

stack erase

stack stk;
int ans =; // ans =5
stk.pop();//removes 5

Here is what the above code is Doing:
1. We create a stack called stk.
2. We push 5 onto the stack.
3. We assign the top element of the stack to the variable ans.
4. We pop the top element off the stack.

Similar Posts