链表一遇到OutPut函数程序就停止运行

初学《数据结构与算法》链表,不知道代码哪里有问题,代码编译和运行都没有问题,但是一遇到OutPut函数程序就停止运行了,选取了一部分代码,求大神解决。

#include<stdio.h>
#include<stdlib.h>
typedef int ElemType;
typedef int Status;
typedef struct lnode
{
    ElemType data;  
    struct lnode*next;  
}LNode; 

void CreateList(LNode*L,int n)  
{
    int i;
    LNode*p;
    L=malloc(sizeof(LNode));  
    L->next=NULL;           
    printf("请连续输入%d个元素:",n);
    for(i=n;i>0;i--)
    {
        p=malloc(sizeof(LNode));  
        scanf("%d",&p->data);     
        p->next=L->next;          
        L->next=p;
    }
}//逆位序建表 

void OutPut(LNode*L)
{
    LNode *p=L->next;
    if(L->next==NULL)
    printf("该链表为空!");
    else
    {
        while(p)
        {
            printf("%d\t",p->data);
            p=p->next;
        }
    }
}

void main()
{
    LNode la;
    int length; 
    printf("请输入链表la长度:");
    scanf("%d",&length);
    CreateList(&la,length);
    printf("该链表的元素有:");
    OutPut(&la);
} 

图片说明

void CreateList(LNode*L,int n)

这个要用双指针,否则函数内改变L不会作用在调用者上

类似问题刚回答过
https://ask.csdn.net/questions/1070799