具体编程如下:#include
#include
struct student
{
long num;
float score;
struct student *next;
};
int n=0;
struct student *creat(struct student *head)
{
struct student *p1,*p2;
p1=p2=( struct student *)malloc(sizeof( struct student));
head=NULL;
scanf("%ld,%f",p1->num,p1->score);
while(p1->num!=0)
{
n+=1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=( struct student *)malloc(sizeof( struct student));
scanf("%ld,%f",p1->num,p1->score);
}
p2->next=NULL;
return(head);
}
void print_string(struct student *head)
{
struct student *temp;
temp=head;
if(head!=NULL)
do
{ printf("%ld,%5.1f",temp->num,temp->score);
temp=temp->next;
}while(temp!=NULL);
}
void main()
{
struct student *head;
head=NULL;
head=creat(head);
print_string(head);
}
测试总是显示:内存不能写。
用VC编程总是显示内存不能写?可是编程是对的啊。
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
悬赏问题
- ¥35 平滑拟合曲线该如何生成
- ¥100 c语言,请帮蒟蒻写一个题的范例作参考
- ¥15 名为“Product”的列已属于此 DataTable
- ¥15 安卓adb backup备份应用数据失败
- ¥15 eclipse运行项目时遇到的问题
- ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
- ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
- ¥15 自己瞎改改,结果现在又运行不了了
- ¥15 链式存储应该如何解决
- ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站