#define STACK_INIT_SIZE 10
#define INCREMENT_SIZE 10
#include
#include
#include
#include
#include
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR -1
#define OVERFLOW -2
typedef int status;
typedef char telemtype;
typedef struct bitnode
{
telemtype data;
struct bitnode *lchild, *rchild;
} bitnode ,*bitree;
status createbitree(bitree *t)
{
char ch;
scanf("%c",&ch);
if(ch='#')t=NULL;
else
{
if(!(t=(bitree *)malloc(sizeof(bitree))))exit(OVERFLOW);
(*t)->data=ch;
creatbitree((*t)->lchild);
creatbitree((*t)->rchild);
}
return OK;
}
status printelement(telemtype e)
{
printf("%c",e);
return OK;
}
status preordertraverse(bitree t,status(* visit)(telemtype e))
{
if (t)
{
if(visit(t->data))
if(preordertraverse(t->lchild,visit))
if(preordertraverse(t->rchild,visit)) return OK;
return ERROR;
}
else return OK;
}
status zhongxu(bitree t,status(* visit)(telemtype e))
{
if (t)
{
if(zhongxu(t->lchild,visit))
if(visit(t->data))
if(zhongxu(t->rchild,visit)) return OK;
return ERROR;
}
else return OK;
}
int main(int argc, char *argv[])
{
int bitnode;
bitree t;
t=NULL;
createbitree(&t);
printf("\n");
preordertraverse(&t,printelement);
zhongxu(&t,printelement);
return 0;
}
错误是
E:\数据结构\main.c In function 'main':
77 19 E:\数据结构\main.c [Warning] passing argument 1 of 'preordertraverse' from incompatible pointer type
45 8 E:\数据结构\main.c [Note] expected 'bitree' but argument is of type 'struct bitnode **'
78 10 E:\数据结构\main.c [Warning] passing argument 1 of 'zhongxu' from incompatible pointer type
58 8 E:\数据结构\main.c [Note] expected 'bitree' but argument is of type 'struct bitnode **'
能帮忙修改下让它运行正常吗、?
不知道为什么被禁言了 能否私信我 谢谢 真的很急 。。