c - fgets instructions gets skipped.Why? -


whenever scanf before fgets fgets instruction gets skipped. have come accross issue in c++ , remember had had instrcution clear stdin buffer or that. suppose there's equivalent c. it?

thanks.

i'll bet it's because of \n stuck in input stream.

see 1 of these questions:

i not able flush stdin.
how go flushing stdin here?
scanf() causing infinite loop

or this answer.

also: why not use scanf().

p.s. fgets() function, not instruction.


Comments