回复 9楼 ileelsai
按照你那样改行了,问一下为什么我那样不行啊
#include<stdio.h>
#include<malloc.h>
typedef struct Student
{
char name[100];
int age;
float score;
}*List,Node;
int main()
{
int len;
int i;
List p;
printf("请输入一共有几位学生:");
scanf("%d",&len);fflush(stdin);
p=(List)malloc(len*sizeof(Node));
for(i=0;i<len;++i)
{
printf("请输入第%d位同学的信息:\n",i+1);
printf("name:");
scanf("%s",&(p+i)->name);
printf("age:");
scanf("%d",&(p+i)->age);
printf("score:");
scanf("%g",&(p+i)->score);
}
for(i=0;i<len;++i)
{
printf("请输出第%d位同学的信息:\n",i+1);
printf("name:%s\n",(p+i)->name);
printf("age:%d\n",(p+i)->age);
printf("score:%g\n",(p+i)->score);
}
return 0;
}
帮你改了下