title: Turbo C++: Why does printf print expected values, when no variables are passed to it?
body: <p>A question was asked in a multiple choice test: What will be the output of the following program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void)
  {
      int a = 10, b = 5, c = 2;
  
      printf("%d %d %d\n");
  
      return 0;
  }
  </code></pre>
  
  <p>and the choices were various permutations of 10, 5, and 2. For some reason, it works in Turbo C++, which we use in college. However, it doesn't when compiled with gcc (which gives a warning when -Wall is enabled) or clang (which has -Wformat enabled and gives a warning by default)  or in Visual C++. The output is, as expected, garbage values. My guess is that it has something to do with the fact that either Turbo C++ is 16-bit, and running on 32-bit Windows XP, or that TCC is terrible when it comes to standards.</p>