You are on page 1of 5

Dale:

Exp

Aim Jileaphoqham to mplemanta stack=

Theay
StacK i s acallection o ele rosats
Fallowing. LEHO A sBacK is- an Abstrac
Polowing- vsedin. mas
Data Type ADL),_cammonly
pegrammiag lang.ua es 1LE is namedsuck
it e haves iKe a real a ld stack,
eqaoleck ocads a-pile a plalu ec
Tkmgtaek_s a cettee-ti can be insarted
removed from one encl h h alemen
uuhich is placed asti accessed irst
Th iosestioo opoaahion callad PusH and
POsHand
mova opehahon is calUed PGP
Sack Rapresendakan:
PSH

Las in- Firstou PoP

e e3
e2 e2
e e

Same o asic apeiation a2


push C). a pop
) 3 pee Is C)
sFullC isEnpky -
SAMRAT
Dale:

Code
tinclude stdio.h
tEinclule onio.h>
int stack 01, chaicen, top ,i
oid puubvaid)
Yaid papYoid)
aid display (yoid),-
i o t main )

top,
pioti An Eotth the size ak Stack [Max 100]
Scan? 1.dlo)
pintf I n lt sTacK aPERAT1ONS USIN ARRAY,
priatt n l t
ottAolt 4.PUSH InlA 2. pOP ntlt epLSPLAY
Aat 4 EXII,
do

Print \n Enes h Cnaice )


scanf 7d choice),_
Suthchaice)

Lpuuh
brtaK
Cak 2
1pap
brrak-

dsptay C SAMRAT
, bauaK
Dale:
fdioplacat
break Phnt4 n Eit Poan)
bual
default
priatf ("Inlt plea Enles a a vald chsice
C1/a3 4))_
4 le (choice
rekun o
void push )
E top n-1)
pánt£ ns TACIK ove ow

else
1paántt CGateaa calu to pughad::
sconf d z,-
tap +
stack C top=

void pop)
P Cop< -)
pnt \n\E stack iundus Plow
else
piatt( nlt Th popped elemant Zd1 s a c k lopl

top

SAMRAT
Vaid displaC)
iftop>0)
intt(n Th elemnH insIACK )
fasli top,izaoi-
piatt Clad, suck [jJ4
PiotfC n Pras Nec Cchaice;

els
arintt n The 6ThCK s empt

Output:
Entes fhe siz o STACKMAX=106 10
STACK OPERATIONS USInG ARRAY

1. PUSH
2. P0P

. DISPLAY

EXTTT

Enta h choice
Eote a valu to lapushod 20
Ente th chala i
eneA a value to e p h d i 30
EnMe tha cho'ic 3
T helenents in stacK

0
Pres ext Choi c2
En tes he dhaico 4
Exit Paint

You might also like