关于 fflush(stdin)
我想问问fflush(stdin)究竟是什么何方神圣?我被度娘搞晕了。。。。。为什么有时候没了它就不行了。另外,输入流和输出流到底是啥东东
代码:
#include <stdio.h>
#include <conio.h>
void main( void )
{
int integer;
char string[81];
/* Read each word as a string. */
printf( "Enter a sentence of four words with scanf: " );
for( integer = 0; integer < 4; integer++ )
{
scanf( "%s", string );
printf( "%s\n", string );
}
/* You must flush the input buffer before using gets. */
fflush( stdin );
printf( "Enter the same sentence with gets: " );
gets( string );
printf( "%s\n", string );
}