#include<stdio.h>
struct stud_type
{
char name[20];
long num;
int age;
char sex;
};
void main()
{
void list(struct stud_type student);
struct stud_type student[3],*p;
int i;
char numstr[20];
for(i=0,p=student;i<3;p++,i++)
{printf("Enter all data of student[%d]:\n",i);
scanf("%s%ld%d%c",p->name,&p->num,&p->age,&p->sex);
}
for(i=0;i<3;i++)
list(student[i]);
}
void list(student)
struct stud_type student;
{
printf("%-2s%8ld%6d%3c\n",student.name,student.num,student.age,student.sex);
}
这个程序在vc++编译时出现以下错误:C:\Documents and Settings\Administrator.F94E4AB1B271471\桌面\ckd.cpp(15) : warning C4101: 'numstr' : unreferenced local variable
C:\Documents and Settings\Administrator.F94E4AB1B271471\桌面\ckd.cpp(23) : error C2065: 'student' : undeclared identifier
C:\Documents and Settings\Administrator.F94E4AB1B271471\桌面\ckd.cpp(24) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
C:\Documents and Settings\Administrator.F94E4AB1B271471\桌面\ckd.cpp(24) : fatal error C1004: unexpected end of file found
该如何改正?