Function: PEEP (S, TOP, I)
- This function returns the value of the Ith element from the TOP of the stack.
- The element is not deleted by this function.
- Stack is represented by a vector S containing N elements.
1. [Check for stack Underflow]
If TOP - I +1 = 0
Then Write (‘STACK UNDERFLOW ON PEEP’)
Return(0)
2. [Return Ith element from top of the stack]
Return (S[TOP – I + 1])