#### Small White C Language Linked List Problem

I just started learning C, and in the process of writing the questions, debug has not found any problems for a long time. . I don’t know why p_node in the following code has always been null, please give some advice.
Problem description:
4-3 Find Table Length of Chain Table (10 Points)
This topic requires the realization of a function to find the table length of a chain table.
Enter sample:

1 3 4 5 2 -1
Output sample:

5

My code:

``````#include <stdio.h>
#include <stdlib.h>

typedef int ElementType;
typedef struct LNode *PtrToLNode;
struct LNode {
ElementType Data;
PtrToLNode Next;
};
typedef PtrToLNode List;

List Read();  /* Details are not shown here */

int Length( List L );

int main()
{
printf("%d\n", Length(L));
return 0;
}

/* Your code will be embedded here */
{
ElementType a;
int i = 0;
List p_list,p_node;

p_list = (List)malloc(sizeof(List));

for (int j = 0;   j < 100;  ++j) {
a[j] = 0;
}
//Scan until the input is -1
scanf("%d",&a[i]);
p_list->Data = a[i];
p_list->Next = NULL;
p_node = p_list->Next;

while (a[i]!  =-1)
{
i++;
scanf("%d",&a[i]);
p_node = (List)malloc(sizeof(List));
p_node->Data = a[i];
p_node->Next = NULL;
p_node = p_node->Next;
}
return p_list;
}
int Length( List L )
{
int num;
while (L->Next !  = NULL)
num++;
return num-1;
}``````

The problem has been solved, and there is a problem with the newly created part of the linked list.