函数fflush(stdin)用于刷新流的输出缓冲区。它返回零,如果成功,则返回EOF并设置feof错误指示符。
这是C语言中fflush(stdin)的语法,
int fflush(FILE *stream);
这是C语言中fflush(stdin)的示例,
#include
#include
int main() {
char s[20] = "Helloworld";
printf("The string : %s", s);
fflush(stdin);
return 0;
}输出结果
The string : Helloworld