标题:这个链表哪里有错吗?谢谢指教
只看楼主
冯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
帖 子:6809
专家分:42393
注 册:2010-12-16
得分:0 
看样子没有什么问题,拿来编译 运行一下不就知道了?

我行我乐
我的博客:
http://blog.yuccn. net
2012-12-27 10:30



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




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

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