交换二叉树的左右孩子
typedef char TElemType;
typedef struct BiNode
{
TElemType data;
stuct BiNode *lchild,*rchild;
}BiNode,*BiTree;
tree create()
{
int x;
tree t;
scanf("%d",&t);
if(x==0) t=NULL;
else
{
t=(tnode *)malloc(sizeof(tnode));
t->data=x;
t->lchild=create();
t->rchild=create();
}
return t;
}
void Treeswap(tree t)
{
if(t)
{
tree p=t->lchild;
t->rchild=t->lchild;
t->lchild=p;
Treeswap(t->lchild);
Treeswap(t->rchild);
}
}