I'm getting a runtime error
Hi,
Could you please take a look at the following code? I'm getting a runtime error every time I enter the average score:
Code:
struct blah {
char firstname[20+1];
char lastname[25+1];
float average;
};
typedef struct blah entry;
int main() {
entry student;
do {
printf("First name: ");
gets(student.firstname);
if (strlen(student.firstname)==0) break;
printf("Last name: ");
gets(student.lastname);
printf("Average score: ");
scanf("%f", &student.average);
// fflush(stdin);
} while (1);
return 0;
}
I simply can't see what I'm doing wrong.