c语言,帮我看我的程序错在哪?

来源:百度知道 编辑:UC知道 时间:2024/06/27 09:58:38
void stack_entire(Stack *s,SElem *e)
{
Stack h;
if(isempty(s))
printf("This is a empty stack\n");
else
{
while(!isempty(s)){
pop(s,e);
printf("%d",e);
push(&h,e);
}

while(!isempty(&h)){
pop(&h,*e);
push(s,e);
}
}
}
我想显示栈里面所有元素,但是显示不出

以下是完整的程序
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#define Max 10

typedef enum bool{TRUE,FALSE}BOOL;
typedef int SElem;
typedef struct stack
{
SElem Elem[Max];
int top;
int base;

}Stack;

void push_data(Stack *s,SElem e);
void pop_data(Stack *s,SElem *e);
void gettop_stack(Stack *s,SElem *e);
void stack_traverse(Stack *s,SElem *e);
void destroy_stack(Stack *s);
void create_stack(Stack *s);
void push(Stack *s,SElem e);
void pop(Stack *s,SElem *e);
void stack_e

这个题我通了,还有什么问题直接问吧。

void stack_entire(Stack *s,SElem *e)
{
Stack h;
create_stack(&h);
if(isempty(s))
printf("This is a empty stack\n");
else
{
while(!isempty(s)){
pop(s,e);
printf("%d,",*e);
push(&h,*e);
}

while(!isempty(&h)){
pop(&h,e);
push(s,*e);
}
}
}

你的有几个函数没定义啊
stack_status(&h)
stack_length(&h)
destroy_stack(&h)
定义完这些就可以了

你把这几个屏蔽后试试程序没问题的!!!!!!!!