求解 关于C语言链表的问题 初学者
程序代码:#include
#include
#include
struct stu
{
int date;
struct stu *next;
};
//建立
struct stu *jianli()
{
struct stu *head;
head=(struct stu *)malloc(sizeof(struct stu));
scanf("%d",&head ->date);
head->next=NULL;
return(head);
}
//遍历
void bianli(struct stu *list)
{
struct stu *p;
for(p=list;p!=NULL;p=p->next);
printf ("%d",p->date);
}
//插入
struct stu *charu (struct stu *list,int n)
{
struct stu *now;
now=(struct stu *)malloc(sizeof(struct stu));
now->date=n;
now->next=list ;
return now;
}
//主函数
main()
{
struct stu *head;
head=jianli();
bianli(head);
head=charu(head,50);
bianli(head);
return 0;
}
为什么提示 链表.exe已停止工作 我是用vs2012编译的。









