姓名:阚姗蕾
学号:2010012030037
上机实验三
ex3_1:
一、程序流程说明
链栈1)链栈结点类型定义为:typedefstruct
odei
tdatastruct
ode
ext
ode_type2)编写进栈函数push3)编写出栈函数pop4)编写mai
函数,首先建立一空链栈;调用进栈函数,将从键盘输入的数据元素逐个进栈,输入0结束;显示进栈后的数据元素;调用两次出栈函数,显示出栈后的数据元素。
二、程序代码
i
cludestdiohi
cludestdlibh
定义链栈typedefstruct
ode_typei
tdatastruct
ode_type
ext
ode_typetypedefstructstack_type
ode_typetopi
tle
gthstack_type
进栈函数voidpushstack_typesi
t
ew
ode
f
ode_typepp
ode_typemallocsizeof
ode_typepdata
ew
odep
extstopstoppsle
gth出栈函数i
tpopstack_types
ode_typepi
txifstopNULLpri
tf