函数套嵌调用问题
											
程序代码:#include<stdio.h>
#include<malloc.h>
struct linknode
{
    int data;
    struct linknode *next;
};
struct linknode *create()//创建单链表
{
    int d;
    int i=1;
    struct linknode *head,*s,*t;
    head=NULL;
   
    printf("建立一个单链表,data域数据已0结束:\n");
    while(1)
    {
        printf("%d:",i);
        scanf("%d",&d);
        if(d==0) 
             break;
        if(i==1)//建立第一个结点
        {
            head=(struct linknode *)malloc(sizeof(struct linknode));
            head->data=d;
            head->next=NULL;
            t=head;
        }
        else//建立其余结点
        {
            s=(struct linknode *)malloc(sizeof(struct linknode));
            s->data=d;
            s->next=NULL;
            t->next=s;
            t=s;
        }
        i++;
    }
    return head;
}
void disp(struct linknode *head)//输出结点数据
{
    struct linknode *p=head;
    printf("输出一个单链表:\n");
    if(p==NULL)
        printf("空");
    while(p!=NULL)
    {
        printf("%d",p->data);
        p=p->next;
    }
    printf("\n");
}
int len(struct linknode *head)//返回单链表的长度
{
    int pcount=0;//结点计数器
    struct linknode *p=head;
    while(p!=NULL)
    {
        p->next;
        pcount++;
    }
    return pcount;
}
struct linknode *JCHB(struct linknode *heada,struct linknode *headb)//交叉合并函数
{
    printf("哈哈,开始调用我了");//刚开始检查是否调用
    struct linknode *ha,*hb,*t,*s,*hc;
    hc=heada;
    ha=heada;
    t=heada;
    hb=headb;
    s=headb;
    /*if(len(ha)!=len(hb))
    {
       
        printf("不合题意,链表长度不同\n");
        return NULL;
    }*/
    while(ha!=NULL)
    {
        t=ha;
        ha=ha->next;
        t->next=hb;
        s=hb;
        hb=hb->next;
        s->next=ha;
    }
    return (hc);
}
void main()
{
    struct linknode *heada,*headb,*headc;
    heada=create();
    disp(heada);//输出链表数据
    headb=create();
    disp(headb);
    headc=JCHB(heada,headb);
    disp(headc);
}问题描述:有两个单链表A,和B A={a1,a2,.....an},B={b1,b2,...bn},写一个函数合并A和B,并形成一个链表C,C={a1,b1,a2,b2...an,bn}
前提是:A和B的长度相同
疑问如下:
当我不把交叉合并函数的if判断语句注释掉的时候就没输出,当我注释掉的时候程序能满足要求!不知为何加上if判断语句就不行
请前辈们指点一二,不胜感激




											


	    

	