我开始学习C。由于我通常使用JAVA编码,所以我选择使用IDE Eclipse而不是Code::Blocks。我已经在用这个非常简单的程序尝试一个错误:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int number=0;
printf("Type a number :\n");
scanf("%d", &number);
printf("You typed %d",number);
return 0;
}
当我编译并运行时,我期待类似的内容:
Type a number
(...) I type my number
You typed xxx
但是,这不是我得到的。当我编译并运行时,控制台中没有出现任何内容。当我输入一个数字并按“Enter”键时,我终于得到:
Type a number
You typed xxx
怎么了?为什么指令没有按预期顺序执行?是Eclipse的问题吗?
感谢您的回答。
最佳答案
嗯,这是 Eclipse 的一个错误。
hessamhedieh 的回答帮助我找到了答案,并且在查找单词后
"Eclipse, scanff fflush(stdout)"
在google中,我发现了很多关于此的帖子bug still unsolved .
关于c - 一个非常简单的程序中的指令顺序错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55059170/