大神们,看下这个程序为什么会报错
#include <stdio.h>#include <malloc.h>
struct Student // 定义一个学生结构体
{
char name[100];
int age;
float score;
};
void Scan(struct Student ** p, int q) //从外部获取学生信息
{
int i;
for (i=0; i<q; i++)
{
printf ("please input name\n");
scanf ("%s", **p[i].name);
printf ("please input age\n");
scanf ("%d", *p[i].age);
printf ("please input score\n");
scanf ("%f", *p[i].score);
}
}
void Print(struct Student ** p, int q) //输出学生信息
{
int i;
for (i=0; i<q; i++)
{
printf("NO.%d %-10s %-2d %-5f\n", i+1 ,**p[i].name, **p[i].age, **p[i].score);
}
}
int main (void)
{
int len;
printf("please input number of student\n");
scanf ("%d", &len);
struct Student * parr;
parr = (struct Student *) malloc (len * sizeof(struct Student));
Scan(&parr,len);
Print(&parr,len);
}