请教一下 flyue
创造二叉排序树
第一个地址 和第二个的差值 和后面的不一样?
struct node *create()
{struct node *p,*r,*b,*f;
b=(struct node*)malloc(sizeof(struct node));
printf("input the nums of tree:(input -1 to stop)\n");
scanf("%d",&b->data);
b->lc=NULL;
b->rc=NULL;
r=NULL;
n=0;
while(b->data!=-1)
{n=n+1;
if(n==1){r=b;p=r;}
else {while(p!=NULL)
{if(b->data<p->data) {f=p;p=p->lc;}
else {f=p;p=p->rc;}
}
}
f=b;
p=r;
printf("p_value:%ld\n",f);
b=(struct node*)malloc(sizeof(struct node));
scanf("%d",&b->data);
}
return(r);
free(b);
}
void main()
{struct node *r;
printf("now ,start to create the tree:\n");
r=create();
}