求二叉树中的叶子结点个数
运行结果总是为 0 怎么回事!!!#include "stdio.h"
#include "stdlib.h"
#include "malloc.h"
typedef char ElemType;
typedef struct BTNode
{
ElemType data;
struct BTNode *lchild,*rchild;
}BTNode,*BTree;
int Leaf(BTree p)
{
int count=0;
if(p==NULL)
{
return count;
}
else
if(p!=NULL)
{
if(p->lchild==NULL&&p->rchild==NULL)
count++;
Leaf(p->lchild);
Leaf(p->rchild);
}
}
int main()
{
int count;
count=Leaf(T);
printf("该二叉树中的叶子结点的个数为:%d\n",count);
}