栈习题实现.docVIP

  • 5
  • 0
  • 约 9页
  • 2017-09-06 发布于辽宁
  • 举报
栈习题实现

#includestdio.h #includestdlib.h #includemalloc.h #includestring.h #define MaxLen 15 typedef int elemtype; typedef struct sqstack//顺序栈(用数组构成的顺序栈结构) { elemtype data[MaxLen]; int top; }stack,*S; typedef struct list { int i; struct list *next; }List,*L; List *CreateList()//创建链表 { L h,temL,l; int ch; h=(List *)malloc(sizeof(List)); h-next=NULL; l=h; printf(please input node infomation on and on until -1\n); while(1) { scanf(%d,ch); getchar(); if(ch!=-1) { temL=(L)malloc(sizeof(List)); temL-i=ch; l-next=temL; temL-next=NULL; l=l-next; }else break; }

文档评论(0)

1亿VIP精品文档

相关文档