请帮忙改改错误
Swap(BinTree) *T
{ BinTree *stack[100], *temp;
int top=-1;
root=T;
if (T!=NULL)
{
top++;
stack[top]=T;
while(top>-1)
{ T=stack[top];
top--;
if (T->child!=NULL||T->rchild!=NULL)
{ // 交换结点的左右指针
temp=T->lchild;
T->lchild=T->rchild;
T->rchild=temp;
}
if (T->lchild!=NULL)
{ top++;
stack[top]=T->lchild;
}
if (T->rchild!=NULL)
{ top++;
stack[top]=T->rchild;
}
}
}
}
main()
{ int i,j,k,l,root;
printf("\n");
root=CreateBinTree();
Inorder (root);
i=CountNode (root);
j=CountLeafs (root);
k=Depth (root);
l=Width (root);
printf("\n The Node ’s Number:%d",i);
printf("\nThe Leafs’s Number:%d",j);
printf("\nThe Depth is:%d",k);
printf("\nThe width is:%d",l);
Swap(root);
Printf("\nThe swapTree is:");
Inorder(root);
}
[解决办法]
结了以前的帖子,再说。