The difference between java and c ++ in stack in the stack

stack.pop (java in) return the top element,

It can be used

Stack<Integer>stack=new Stack<Integer>();

int top=stack.pop()

And c ++'s stack.pop () pop the top element, does not return a value.

Stack <int> myStack 
int Top = myStack.pop () with this is not acceptable. 
c ++ is int top = myStack.top ();
Released nine original articles · won praise 15 · views 3011

Guess you like

Origin blog.csdn.net/u010259177/article/details/104593098
Recommended