标题:求解 关于C语言链表的问题 初学者
只看楼主
小学一班
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2016-6-9
结帖率:0
已结贴  问题点数:20 回复次数:1 
求解 关于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编译的。

搜索更多相关主题的帖子: C语言 include 
2016-06-09 15:57
alice_usnet
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:18
帖 子:370
专家分:2020
注 册:2016-3-7
得分:20 
for(p=list;p!=NULL;p=p->next) //;

未佩好剑,转身便已是江湖
2016-06-09 16:32



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-465758-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.282272 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved