为了账号安全,请及时绑定邮箱和手机立即绑定

请问这个要怎么办?

请问这个要怎么办?

C
ZXJ03 2016-05-13 23:05:59
#include <stdio.h> #include <malloc.h> #define OK 1 #define ERROR 0 typedef int status; typedef  struct  Subject  { float score;    char  course;   struct Subject *next;  }Subject,*SList; status create_S(SList &L)  {  SList p; int i,n;                L=(Subject *)malloc(sizeof(Subject));  L->next=NULL;    printf("Input the element number:");  scanf("%d",&n);      printf("Input the element value reversing:\n");  for (i=n;i>0;--i)         {  p=(Subject *)malloc(sizeof(Subject));           scanf("%s,%f",&p->course,&p->score);       p->next=L->next;           L->next=p; }   printf("The linklist as follow:\n");      for (i=0;i<n;++i)  { printf("%s,%f\n",&p->course,&p->score);    p=p->next;  }  printf("\n");  return OK; }  void main(){ SList head; create_S(head); }结果是这样,请问哪里出错了?要怎么改?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1129 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信