C/C++ printf() before scanf() issue
问题 I\'m using Eclipse to code in C/C++ and I\'m struggling with what might be something pretty easy. In my code below I use printf() and after scanf() . Althougth printf is written before scanf() the output differs. I was able to find out something about similar issue here. But I wasn\'t able to solve it. Any ideas? Code: #include <stdio.h> int main() { int myvariable; printf(\"Enter a number:\"); scanf(\"%d\", &myvariable); printf(\"%d\", myvariable); return 0; } Expected output: Enter a number