标题:[求助]关于建立动态链表的问题
只看楼主
dou
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-5-6
 问题点数:0 回复次数:0 
[求助]关于建立动态链表的问题

#include <stdio.h>

#include <malloc.h>
#define LEN sizeof(stuct student)

struct student
{long num;
float score;
struct student *next;}

main()
{
struct student a,b,c,*head,*p1,*p2,*p3;
head=NULL;
p1=p2=(struct student*)malloc(LEN);
scanf("%ld,%f",p1->num,p1->score );
if(p1->num=0) head=NULL;
else
{head=p1;
while(1)
{ p1=(struct student*)malloc(LEN);
scanf("%ld,%f",p1->num,p1->score );
if(p1->num!=0)
{
p2->next=p1;
p2=p1;
}
else p2->next=NULL;
if (p2->next==NULL)
break;
}

}

}
P3=head;
while(p!=NULL)
{printf("%ld,%f",p3->num,p3->score);
p3=p3->next;
}


}

---Configuration: dddde - Win32 Debug--------------------
Compiling...
d.cpp
D:\Program Files\Microsoft Visual Studio\MyProjects\dddde\d.cpp(12) : error C2628: 'student' followed by 'void' is illegal (did you forget a ';'?)
D:\Program Files\Microsoft Visual Studio\MyProjects\dddde\d.cpp(41) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

dddde.exe - 2 error(s), 0 warning(s)请问新手,请指点哈兹。。。

[此贴子已经被作者于2007-10-15 16:12:57编辑过]

搜索更多相关主题的帖子: 链表 动态 
2007-10-15 15:44



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




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

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