第一次没问题,第二次打印姓名?它打印Name?Class?
#include <stdio.h>
#define LENGTH(x) sizeof(x)/sizeof(x[0])
typedef struct {
char name[50];
char class;
} student;
int main()
{
student students[3];
int i;
for (i=0; i<LENGTH(students);i++){
printf("Name?"); fgets(students[i].name, 100, stdin);
printf("Class?"); scanf("%c", &students[i].class);
}
}