I use Xcode 7.3 to program on C. I have a problem in my code:
printf("Enter first name: ");
fflush(stdin); //here I use getchar() instead of fflush(stdin)
fgets(temp->firstName, KOL, stdin);
(temp->firstName)[strlen(temp->firstName)-1]='\0';
fflush(stdin);
printf("Enter last name: ");
fflush(stdin);
fgets(temp->lastName, KOL, stdin);
(temp->lastName)[strlen(temp->lastName)-1]='\0';
Compiler skips input of the first name (fflush(stdin) doesn't help). I found one solution, but it's not the best one: I use getchar() before input of the first name. If you now the reason of this problem and know, how to solve, please help me.