3个回答
展开全部
你的题目要求是什么数据没有初始化而且没有那么多错误#include#defineNULL0#defineLENsizeof(structstudent)structstudent{charno[5];floatscore;structstudent*next;};structstudent*create();voidprint(structstudent*head);voidmain(){structstudent*list_headp;list_headp=create();//是赋值为结构体,不用加*print(list_headp);}structstudent*create(){structstudent*head=NULL,*tail,*new;intcount=0;for(;;){new=(structstudent*)malloc(LEN);//stu代表structstudentprintf("pleaseinputthenumberofstudentNo.%d:\n",count+1);scanf("%s",new->no);if(strcmp(new->no,'*')==0){free(new);break;}printf("inputthescoreofstudentNo.%d",count+1);scanf("%f",&new->score);count++;if(count==1)head=new;elsetail->next=new;tail=new;new->next=NULL;}returnhead;}voidprint(structstudent*head){structstudent*p;p=head;if(head==NULL)printf("thelinkisempty\n");elsewhile(p!=NULL)//——————判断两个数不相等的话,用一个=就行了,只有相等才需要=={printf("%5s%4.1f",p->no,p->score);p=p->next;}}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询