|
Stacks->Array Implementation->Push operation |
||
| Here, as you might
have noticed, addition of an element is known as the PUSH operation. So,
if an array is given to you which is supposed to act as a STACK, you
know that it has to be a STATIC Stack; meaning, data will overflow if
you cross the upper limit of the array. So, keep this in mind.
Algorithm:-
C implementation:- push(int new) Damn simple, no! I think no more comments are needed for this... Note:- In array implementation, I have taken TOP = -1 to signify the empty stack, as this simplifies the implementation. Related Operations: |
||
| Index || Doubts / Clarifications || Related Topics || Web Links | ||