关于构建树的错误C2039,vs2010&;win7 O.O 在学习数据结构时,我编写了一个构建树的代码。编译后,下面显示错误2039:“Left”:不是“TreeNode”的成员。我不知道这个错误是如何发生的

关于构建树的错误C2039,vs2010&;win7 O.O 在学习数据结构时,我编写了一个构建树的代码。编译后,下面显示错误2039:“Left”:不是“TreeNode”的成员。我不知道这个错误是如何发生的,c,visual-studio-2010,data-structures,C,Visual Studio 2010,Data Structures,我的代码: #include<stdio.h> #define MaxTree 10 #define ElementType char #define Tree int #define Null -1 struct TreeNode { ElementType Element; /*data*/ Tree Left; /*left child id*/ Tree Right; /*right cild id*/ }

我的代码:

#include<stdio.h>
#define MaxTree 10
#define ElementType char
#define Tree int
#define Null -1

struct TreeNode
{
    ElementType Element;  /*data*/
    Tree Left;            /*left child id*/
    Tree Right;           /*right cild id*/
}T1[MaxTree],T2[MaxTree];

...

Tree BuildTree(struct TreeNode T[])
{
int i;
int N;
int check[MaxTree];
char cl,cr;
int Root;

scanf("%d\n",&N); 
if(N){
    for(i=0;i<N;i++){   
        check[i] = 0;   
        }

    for(i=0;i<N;i++){
        scanf("%c %c %c\n",&T[i].Element,&cl,&cr);
        if(cl!='-'){
            T[i].Left = cl-'0';   /*Report error C2039 !!!*/                     
            check[T[i].Left]=1;
        }
        else{
            T[i].Left = Null;    /*No report error C2039 !!!*/
        }

        if(cr!='-'){
            T[i].Right = cl-'0'; 
            check[T[i].Right]=1;
        }
        else{
            T[i].Right = Null
        }
    }

    for(i=0;i<N;i++)   
        if(!check[i]){
            break;
        }

    Root = i;

}

return Root; 
}

...
#包括
#定义MaxTree 10
#定义元素类型字符
#定义树int
#定义Null-1
树状结构
{
ElementType元素;/*数据*/
左树;/*左子id*/
右树;/*右cild id*/
}T1[MaxTree],T2[MaxTree];
...
树构建树(结构树节点T[]
{
int i;
int N;
整数检查[MaxTree];
炭氯,铬;
int根;
scanf(“%d\n”,&n);
如果(N){

对于(i=0;i请提供复制问题的完整信息)(请参见。我无法复制此类问题。另请参见
T[i]。Right=Null
-->
T[i].Right=Null;
N
为>=MaxTree时会发生什么情况。请注意,按照惯例,通过
#define
定义的名称都是带有
-
下划线的大写字母,分隔根单词调用任何
scanf()
函数族时,始终检查返回值(而不是参数值)为确保操作成功。最好在准备调用函数时:
scanf()
输出提示,让用户知道他们要做什么。关于:
if(cr!='-'){T[i]。Right=cl-'0';
第二行不应该是:
T[i].Right=cr-'0';
注意:
cr
cl