As fflush(stdin); is wrong. Some one suggests using rewind(stdin) to eliminate input buffer and also clear error state of the stream. Is that right?
I used Dev-C++ to compile this code, and it really works. Is it right to use rewind(stdin); ?
As for as I know, rewind(fp) is equivalent to fseek(fp, 0L, SEEK_SET); clearerr(fp). So I guess this is another wrong thing to clear input buffer.