Professional Documents
Culture Documents
4 Thque
4 Thque
4 Thque
PoqTam
# includeestaio-h>
itt max&ine = 8
int StockIRI
nt Hop--1
it tsempty C
Htop= 1)
Teton 4
e lSe
Tetum O
int fs-ful t)
(top = =
max.Size)
Tetoon 4
elle
etosn O
fnt peek ()
leton stack [top];
fvt popc)
fnct docta,
H(11s emptyC)
dala- 8tack Itop
Hop toP1
etoin data
else
Privf stack is emptt)
op-topt
Stack top] dot a
3
else
PrinttC tack ts ull. In")
Int Tmain ()
Push(3)
Push (5)
Push ()
Push o)
Push1a)
Push( is)
Push (14),
at top ot the _etack %d n Pee k C))
Privett C"E le mevtt
Printt s lementt are In)
Ouctput
k lement at top of he stack : 19
lemevts
3
&tack-full: 0
Stack emptyt 4
etack dopA ts em pt
Fxplanaton! The
n ptoqram heTmaximom Size is 8 Ci.e ) oto .
4hf t
he add ol eoments. PopC) oderatton
PUsh) operatton to
he
oloes he elimimatton tetomutt.butt An thic program
&tack f full nen he etumact get elimino.td.
isempty operatto chec kethe tack f-fmpty.
iSfall opeyation check-ne etack tc -full.