Jun 20, 2017 at 5:37am Jun 20, 2017 at 5:37am UTC
theStack.push( 1);
theStack.push(2);
theStack.push(3);
theStack.push(theStack.popO);
theStack.push(theStack.popO +theStack:popO);
theStack.push(6);
theStack.push(7);
theStack.push(theStack.popO * theStack.popO);
Hi I am having problem in understanding above mentioned lines. could anyone please explain above line. First 3 lines adding values to the stack frames. what happens with 4th-8th lines?
Jun 20, 2017 at 8:55am Jun 20, 2017 at 8:55am UTC
theStack.popO should probably be theStack.pop() .
push adds an element at the top of the stack.
pop removes an element from the top of the stack.
Line 4 pops the value 3 off the stack and then pushes the same value 3 on to the stack again leaving the stack in the same state as before.
Last edited on Jun 20, 2017 at 8:56am Jun 20, 2017 at 8:56am UTC