Pop

The Pop() function is used to remove an element from the top of the stack(newest element in the stack). The element is removed to the stack container and the size of the stack is decreased by 1.

Removes the newest element in the stack or basically the top element.

Syntax :

pop(Stack)
Parameters Description
stack Data type that serves as a collection of elements.

Example :

pen
pencil
paper
eraser
marker
ipop = pop();
ipop = pencil
       paper
       eraser
       marker