首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

初学数据结构 二叉树的有关问题

2012-03-07 
初学数据结构 二叉树的问题#includestdio.h#includestdlib.h#includemalloc.h#defineOK1#defineOVER

初学数据结构 二叉树的问题
#include   <stdio.h>
#include   <stdlib.h>
#include   <malloc.h>

#define   OK   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){
TElemType   ch;
scanf( "%c ",&ch);

if(ch== '   ')   T=NULL;
else{
if(!(T=(BiTNode   *)malloc(sizeof(BiTNode))))   exit(OVERFLOW);
T-> data=ch;
CreateBiTree(T-> lchild);
CreateBiTree(T-> rchild);
}
return   OK;
}

void   main()
{

CreateBiTree(BiTree   &T);
}


报错如下:
--------------------Configuration:   compress   -   Win32   Debug--------------------
Compiling...
compress.cpp
E:\数据结构\树\compress.cpp(35)   :   error   C2065:   'T '   :   undeclared   identifier
E:\数据结构\树\compress.cpp(35)   :   error   C2275:   'BiTree '   :   illegal   use   of   this   type   as   an   expression
                E:\数据结构\树\compress.cpp(15)   :   see   declaration   of   'BiTree '
Error   executing   cl.exe.

compress.exe   -   2   error(s),   0   warning(s)

二叉树学习中   请多执教!


[解决办法]
void main()
{

CreateBiTree(BiTree &T); //哪有这么调用的
}

热点排行