Anonymous

Discuss The STACK Operation With Suitable Example And Show How To Implement Stack Operations Of Integer In C By Using Array?

3

3 Answers

Adam Yare Profile
Adam Yare answered
A stack, also known as an execution stack, control stack and run-time stack, is a term used in computer science referring to a data structure that stores information about the subroutines of a specific computer program.

Stack operations are used for several purposes in a computers operating system, however their main usage is to control when a programs subroutine should finish executing.

More specifically a stack is known as a LIFO or last in, first out abstract data type. It is characterized simply by three operations:

  • Push
  • Pop
  • Stack-top
The push operation adds any new item to the top of the stack, or starts the stack if it is laying dormant. The pop element removes an item from the top of the stack if there is not enough space to accept a new item, also known as an overflow state.

The stack-top operation gets the data from the top position and returns it to the user without having to delete it.

The pop and push of a stack operation mean that items are removed from the stack in the reverse order to that which they joined. Therefore lower items in a stack, are those that will have been on the stack the longest.

A stack operation is a complex system to understand, for further information you should consult a textbook, these can be found in most academic book shops or online via a search engine.

Alternatively you may wish to consult a computer scientist, or your professor/tutor.
Anonymous Profile
Anonymous answered
Operations of stack

Answer Question

Anonymous