如果你用的tc的话main函数里的float arg,*point=&arg;必须存在
否则就回出现BUG;
#include
struct student
{
long number;
char name[10];
float score[3];
float sum1;
};
struct student a[5];
void scan(struct student *p)
{
scanf("%ld%s%f%f%f",&p->number,p->name,&p->score[0],
&p->score[1],&p->score[2]);
}
void sum(struct student *p)
{
p->sum1=(p->score[0]+p->score[1]+p->score[2]);
}
void print(struct student *p)
{
printf("%ld: %s: %5.2f %5.2f %5.2f %5.2f\n",p->number,
p->name,p->score[0],p->score[1],p->score[2],p->sum1);
}
void main()
{
float arg,*point=&arg;
int i;
for(i=0;i<5;i++)
scan(a+i);
for(i=0;i<5;i++)
sum(a+i);
printf("the result:\n");
for(i=0;i<5;i++)
print(a+i);
}