文章
10
粉丝
0
获赞
50
访问
791
二叉树遍历(c语言)
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int n;
char a[100];
typedef struct Tree
{
char a;
struct Tree *lchild,*rchild;
}Tree,*BTree;
void creatT(BTree *T)
{
if(a[n]=='#')
{
(*T)=NULL;
++n;
return;
}
else if(a[n]=='\0')
{
(*T)=NULL;
return ;
}
else
{
(*T)=(BTree)malloc(sizeof(Tree));
(*T)->a=a[n];
++n;
creatT(&(*T)->lchild);
&nb...
登录后发布评论
暂无评论,来抢沙发