title: Why does this C code compile in Codeblocks, but not in Visual Studio?
body: <p>When I try to compile the following C code on Visual Studio 2017 with default C/C++ settings:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  
  /* function declaration */
  /*Line 6*/ int max(int num1, int num2, int num3); 
  
  int main() {
  
  /* local variable definition */
  int a = 100;
  int b = 200;
  int c = 400;
  int ret;
  
  /* calling a function to get max value */
  ret = max(a, b, c);
  printf("Max value is : %d\n", ret);
  return 0;
  }
  
  /* function returning the max between two numbers */
  /*Line 25*/ int max(int num1, int num2, int num3) {
  
  /* local variable declaration */
  int result;
  
  if (num1 &gt; num2)
  result = num1;
  else
  result = num3;
  return result;
  }
  </code></pre>
  
  <p>I get the error(s):</p>
  
  <p>Expected an Identifier: Line(s) 6,25</p>
  
  <p>Expected a ";": Line(s) 25</p>
  
  <p>Intellisense highlights those lines and wont let me run the code. Yet in Codeblocks (Using the default GNU GCC compiler, from mingW) this EXACT code compiles just fine. What is causing this? </p>
  
  <p>Multiple sources have told me that its not due to Codeblocks using GCC compiler
  and Visual Studio using "cl" compiler by default.</p>
  
  <p>The same sources have told me that it is also not due to the possibility of each IDE compiling the code using different C standards.</p>
  
  <p>I have named the the file extension as ".c" and I get these errors</p>
  
  <p>If I try to compile the code as c++(or as a ".c++" file it works, but that's not what I want.
  I want C.</p>
  
  <p>I would prefer to use Visual Studio over Codeblocks due to its sleek look and menu layout. I also prefer the Visual Studio debugger.</p>
  
  <p>What steps can I take to successfully compile this simple code on Visual Studio 2017?</p>