代码显示段错误,请问哪里有问题

img


裁判测试程序样例:

#include
#include

typedef char ElemType;
typedef struct BiTNode
{
ElemType data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;

BiTree Create();/* 细节在此不表 */

int LeafCount ( BiTree T);

int main()
{
BiTree T = Create();

printf("%d\n", LeafCount(T));
return 0;

}
/* 你的代码将被嵌在这里 */

img


我的代码,显示错误原因为段错误
int LeafCount ( BiTree T)
{
int n;
if(T==NULL)
return 0;
if(T->lchild==NULL)
n=1;
if(T->lchild!=NULL)
LeafCount (T);
if(T->rchild!=NULL)
LeafCount (T);
return n;
}

你这是个标准无限递归呀
递归的时候参数要传T->lchild才对呀,你怎么把T自身继续往下传