这段简单的单练表怎么就出错了?错在哪里?奇怪?谢谢

Kenn_C Kenn_C 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#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();
}
...全文
评论 7
收藏 已收藏
分享
返回顶部
Kenn_C
C语言 70,038 成员 243,237 内容