C program skips 'fgets' command

已回答

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

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

0

请先登录再写评论。