这段简单的单练表怎么就出错了?错在哪里?奇怪?谢谢
#include <stdio.h>
struct Node{
int info;
struct Node *next;
};
typedef struct Node *PLinkList;
main()
{
int i,n,e;
printf("How many nodes you want to creat:");
scanf("%d",&n);
PLinkList L=(PLinkList)malloc(sizeof(struct Node));
L -> next = NULL;
if(L != NULL){
for(i = n;i > 0; i--)
{
PLinkList p=(PLinkList)malloc(sizeof(struct Node));
if(p != NULL)
{
printf("input:");
scanf("%d",&e);
p -> info = e;
p -> next = L -> next;
L -> next = p;
}
}
}
while(L -> next != NULL)
{
printf("%d\n",L -> next -> info);
L = L -> next;
}
getch();
}