急!!程序不能显示决策树,求大神赐教

//建立决策树
struct TREE CreatTree(struct TRAINING *head)
{
struct TREE *root,*t1,*t2;
struct GAINRATIO *max;
struct TRAINING *sub1,*sub2,*head1;
int i,attr,s;
root=(struct TREE
)malloc(sizeof(struct TREE));
if(ClassIsEmpty(head))
{
root->attribute=NOTHING;
return root;
}
if(ClassAllSame(head))
{
root->attribute=head->next->b8;
return root;
}
max=Getmax(5,head);
attr=MaxValue(5,max);
for(i=0;i {
if(i==attr)
{
s=max->w;
printf("波段:%d 阈值:%d 位置:%d 信息增益比:%f\n",attr,max->t,max->w,max->GainRatio);
break;
}
max=max->next;
}
head1=bubblesort(attr,head);
sub1=GetSub1(s,head1);
sub2=GetSub2(s,head1);
/*if(ClassAllSame(sub1)&&ClassAllSame(sub2))
{
root->attribute=attr;
return root;
}
else
{*/
root->attribute=attr;
switch(attr)
{
case 1:
t1=(struct TREE*)malloc(sizeof(struct TREE));
t1=root->left;
t2=(struct TREE*)malloc(sizeof(struct TREE));
t2=root->right;
t1=CreatTree(sub1);
t2=CreatTree(sub2);
break;
case 2:
t1=(struct TREE*)malloc(sizeof(struct TREE));
t1=root->left;
t2=(struct TREE*)malloc(sizeof(struct TREE));
t2=root->right;
t1=CreatTree(sub1);
t2=CreatTree(sub2);
break;
case 3:
t1=(struct TREE*)malloc(sizeof(struct TREE));
t1=root->left;
t2=(struct TREE*)malloc(sizeof(struct TREE));
t2=root->right;
t1=CreatTree(sub1);
t2=CreatTree(sub2);
break;
case 4:
t1=(struct TREE*)malloc(sizeof(struct TREE));
t1=root->left;
t2=(struct TREE*)malloc(sizeof(struct TREE));
t2=root->right;
t1=CreatTree(sub1);
t2=CreatTree(sub2);
break;
default:
return NULL;
}

// }
return root;
}
//显示决策树
void DisplayTree(struct TREE t)
{
struct TREE *p,*t1,*t2;
p=t;
if(p)
{
printf("(");
printf("tree=%d\n",p->attribute);
t1=(struct TREE
)malloc(sizeof(struct TREE));
t1=p->left;
t2=(struct TREE*)malloc(sizeof(struct TREE));
t2=p->right;

    DisplayTree(t1);
    if(t2)
    {
        printf(",");
        DisplayTree(t2);
        printf(")");
    }
}

}