Skip to content

Stack: Pop

Task: Remove the top value from the stack

ABtopRETURNEDCno longer on the stack

What you are watching

Pop removes the value on top and returns it. C was pushed last and so leaves first - last in, first out - and B, which was underneath it, becomes reachable for the first time since C arrived. Nothing else moves: the values below keep their positions, and only the top pointer steps down.