数据结构实验报告 学院:** 专业:**** 班级:****** 学号:****** 姓名:** 程序设计目的:计算杨辉三角第n行,第k列的数,并打印杨辉三角。 #include #include typedef int ElemType; struct StackSq { ElemType *stack; int top; int MaxSize; }; struct sNode { ElemType data; struct sNode* next; }; void InitStack (struct sNode** HS) { *HS=NULL; } void Push (struct sNode** HS,ElemType x) {struct sNode *newp; newp=malloc(sizeof (struct sNode)); if(newp==NULL) { printf("内存动态空间用完,退出运行!\n"); exit (1); } newp->data=x; newp->next=*HS; *HS=newp; } ElemType Pop(struct sNode** HS) { struct sNode* p; ElemType temp; if(*HS==NULL) { printf("栈空无法删除!\n"); exit(1); } p=*HS; *HS=p->next; temp=p->data; 本文来源:https://www.wddqw.com/doc/496ddb25b91aa8114431b90d6c85ec3a87c28bb3.html