回复 4楼 alice_usnet
有完整的吗?
#include<stdio.h>
struct student
{
char num[6];
char name[8];
char sex;
union
{
int five;
float hundred;
}score;
}stu[2];
void input(struct student stu[])
{
scanf("%s",stu[1].num);
scanf("%s",stu[1].name);
scanf("%c",&stu[1].sex);
scanf("%d",&stu[1].score);
}
void print(struct student stu[])
{
printf("%s\n",stu[1].num);
printf("%s\n",stu[1].name);
printf("%c\n",stu[1].sex);
printf("%d\n",stu[1].score.five);
printf("%ld\n",stu[1].score.hundred);
}
void main()
{
input(stu);
print(stu);
}
结果有问题