Buffering issue with printf and scanf in C #198299
-
Discussion TypeQuestion Discussion ContentHi everyone, |
Beta Was this translation helpful? Give feedback.
Answered by
EliottBDR
Jun 7, 2026
Replies: 1 comment
-
|
Hi! Yes, this is normal behavior due to standard output buffering. To force the text to display immediately before the scanf execution, you just need to flush the output buffer right after your printf using fflush(stdout);. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Guenonn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Yes, this is normal behavior due to standard output buffering. To force the text to display immediately before the scanf execution, you just need to flush the output buffer right after your printf using fflush(stdout);.