C program skips 'fgets' command

Answered

I've tried adding fflush(stdin) before and after my printf's also tried with fflush(stdout) yet nothing helps.
First time the code runs fine, but in the next iteration it skips entirely the first fgets and so does on every next iteration.

//-----------------------//
printf("Enter full name: ");
fgets(fullName, 20, stdin);

printf("Enter ID: ");
scanf("%ld", &ID);
//-----------------------//
0
1 comment

Could you please check that your project correctly works in the terminal outside of CLion?

0

Please sign in to leave a comment.