OK, this is a part of a program that I wrote:
It didn't work this way (it allows me to enter data only once), so I put fflush(stdin) for no particular reason and now it works. Why is that?Code:#include <stdio.h> #include <string.h> struct info { char firstname[20+1]; char lastname[25+1]; float score; }; int main() { struct info student; do { printf("Type in the name: "); gets(student.firstname); if (strlen(student.firstname)==0) break; printf("Type in the last name: "); gets(student.lastname); printf("Type in the score: "); scanf("%f", &student.score); //fflush(stdin); } while (1); return 0; }