| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 325 人关注过本帖
标题:这个链表哪里有错吗?谢谢指教
只看楼主 加入收藏
冯jungle
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2012-12-16
结帖率:87.5%
收藏
 问题点数:0 回复次数:1 
这个链表哪里有错吗?谢谢指教
// 链表.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

struct Student
{
    int num;
    float cj;
    struct student*next;
};

int main(int argc, char* argv[])
{
    struct Student a,b,c,*head,*p;

    a.num=101;a.cj=99.0;
    b.num=102;b.cj=89.7;
    c.num=103;c.cj=79.4;
    head=&a;
    a.next=&b;
    b.next=&c;
    c.next=NULL;
    p=head;
    while(p!=NULL)
    {
        printf("5d\t%5.1f\t\n",(*p).num,(*p).cj);
        p=(*p).next;
    }
    printf("Hello World!\n");
    return 0;
}
搜索更多相关主题的帖子: head include 
2012-12-27 10:15
yuccn
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:何方
等 级:版主
威 望:167
帖 子:6815
专家分:42393
注 册:2010-12-16
收藏
得分:0 
看样子没有什么问题,拿来编译 运行一下不就知道了?

我行我乐
公众号:逻辑客栈
我的博客:
https://blog.yuccn. net
2012-12-27 10:30
快速回复:这个链表哪里有错吗?谢谢指教
数据加载中...
 
   



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

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