【c语言/链表】两个有序单链表合成为一个有序单链表,自己写的代码运行出错,求助

两个有序单链表合成为一个有序单链表,自己写的代码运行出错,
弄了很久都没解决,是我的思路错了,还是代码细节出问题了?求大神帮忙
编译通过,但是运行是直接提示exe停止运行

#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int data;
    struct node  *next;
}Node,*Link;

Link newList(int a[],int n,Link head)//创建单链表
{
    //头插法
    //创建头结点
    Link node;
    int i;
    head=(Link)malloc(sizeof(Node));
    head->next=NULL;
    //创建后续节点
    for(i=n;i>0;i--)//由于是头插法,将数组元素从后往前放入单链表
    {
        node=(Link)malloc(sizeof(Node));
        node->data=a[i-1];
        node->next=head->next;
        head->next=node;

    }
    return head;
}

void sortlink(Link one,Link two,Link three)//单链表合成
{
    int i,j,t;
    one=one->next;
    two=two->next;
    three=three->next;
    while(one||two)
    {
        i=one->data;
        j=two->data;
        if(i<=j)
        {
            three->data=i;
            one=one->next;
            three=three->next;
        }
        else
        {
            three->data=j;
            two=two->next;
            three=three->next;
        }
    }
}
void outputlink(Link three)//输出合成的单链表
{
    int a;
    three=three->next;
    while(three)
    {
        a=three->data;
        printf("%d",a);
        three=three->next;
    }
}




void main(){
    int a[100],b[100],c[200],i,n,m,t;
    Link one,two,three;
    printf("请输入第一个链表的长度(不超过100)");
    scanf("%d",&n);
    printf("请输入第二个链表的长度(不超过100)");
    scanf("%d",&m);
    t=n+m;
    printf("请输入第一个链表的值(有序)");
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    printf("请输入第二个链表的值(有序)");
    for(i=0;i<m;i++)
    {
        scanf("%d",&b[i]);
    }

    newList(a,n,one);
    newList(b,m,two);
    newList(c,t,three);
    sortlink(one,two,three);
    outputlink(three);
}

问题解决的话,请点下采纳

#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int data;
    struct node  *next;
}Node,*Link;

Link newList(int a[],int n)//创建单链表
{
    //头插法
    //创建头结点
    Link node;
    int i;
    Link head=(Link)malloc(sizeof(Node));
    head->next=NULL;
    //创建后续节点
    for(i=n;i>0;i--)//由于是头插法,将数组元素从后往前放入单链表
    {
        node=(Link)malloc(sizeof(Node));
        node->data=a[i-1];
        node->next=head->next;
        head->next=node;

    }
    return head;
}

void sortlink(Link one,Link two,Link three)//单链表合成
{
    int i,j,t;
    one=one->next;
    two=two->next;
    three=three->next;
    while(true)
    {
        if (!one && !two) return;
        if(one && two)
        {
            if (one->data<=two->data)
            {
                three->data=one->data;
                one=one->next;
            }
            else
            {
                three->data=two->data;
                two=two->next;
            }
        }
        else
        {
            if (one)
            {
                three->data=one->data;
                one=one->next;          
            }
            else
            {
                three->data=two->data;
                two=two->next;          
            }
        }
        three=three->next;
    }
}
void outputlink(Link three)//输出合成的单链表
{
    int a;
    three=three->next;
    while(three)
    {
        a=three->data;
        printf("%d",a);
        three=three->next;
    }
}

int main(){
    int a[100],b[100],c[200],i,n,m,t;
    Link one,two,three;
    printf("请输入第一个链表的长度(不超过100)");
    scanf("%d",&n);
    printf("请输入第二个链表的长度(不超过100)");
    scanf("%d",&m);
    t=n+m;
    printf("请输入第一个链表的值(有序)");
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    printf("请输入第二个链表的值(有序)");
    for(i=0;i<m;i++)
    {
        scanf("%d",&b[i]);
    }

    one=newList(a,n);
    two=newList(b,m);

    three=newList(c,t);
    sortlink(one,two,three);
    outputlink(three);
}