离散数学第章习题答案.docVIP

  • 60
  • 0
  • 约16.97万字
  • 约 23页
  • 2016-12-19 发布于河南
  • 举报
#includestdio.h #includestdlib.h #includemalloc.h #define MAX_STACK_SIZE 100 typedef int ElemType; typedef struct { ElemType data[MAX_STACK_SIZE]; int top; } Stack; void InitStack(Stack *S) { S-top=-1; } int Push(Stack *S,ElemType x) { if(S-top==MAX_STACK_SIZE-1 ) { printf(\n Stack is full!); return 0; } S-top++; S-data[S-top]=x; return 1; } int Empty(Stack *S) { return (S-top==-1); } int Pop(Stack *S,ElemType *x) { if(Empty(S)) { printf(\n Stack is free!); return 0; } *x=S-data[S-top]; S-top--; r

文档评论(0)

1亿VIP精品文档

相关文档