title: Unexpected behavior on eclipse console for C language
body: <p>I'm learning to code, and now i'm focusing on the C language. Recently, i bought a course about it and the IDE used by the teacher is Eclipse. At first i had some problems to run the code, but it was solved with a little research, but when i tried something as simple as put a printf() before a scanf(), things didn't worked as intended, <strong>scanf() is being executed before the printf() that preceds it</strong>, like you can see: </p>
  
  <p><img src="https://i.stack.imgur.com/TfXEA.png" alt="Eclipse console behavior"></p>
  
  <p>Then, i tried to run the code on windows cmd, writing on a notepad, compiling with gcc and running on prompt, and it worked as intended: </p>
  
  <p><img src="https://i.stack.imgur.com/1Npsq.png" alt="code behavior on cmd"></p>
  
  <p>After that, i tried running the code on another IDE, Code Blocks, and the result was the same as running on cmd, it worked like intended: </p>
  
  <p><img src="https://i.stack.imgur.com/KgyLa.png" alt="Code Blocks behavior"></p>
  
  <p>Now, to be clear, <strong>i know that fflush(stdout); command works if i insert it before scanf()</strong> and that it's buffer related (what i did not  understand properly yet), but <strong>i don't understand why the problem exists on Eclipse, but it does not happen on other platforms</strong>. My teacher explained that it was related due windows being a domestic OS and being problematic with professional tools, like Eclipse. But still it doesn't makes sense to me, the same code on the same OS, work on a IDE and don't work on other. It is very problematic to write a imprevisible code in such basic level, quite impossible to trust any result or learn the language properly that way. Can anyone help me with that?</p>
  
  <p>i will leave the code here, but like i said, it is very very simple, just to illustrate the problem: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() {
  
      int n;
  
      printf("Type an integer: ");
      fflush(stdout);
      scanf(" %d", &amp;n);
  
      printf("\nNumber = %d\n\n", n);
  
  return 0;
  }
  </code></pre>