title: Why does C not support initializing const variables using an if-else statement?
body: <p>I want to initialize a <code>const</code> variable using an <strong>if-else</strong>.<br> For example:</p>
  
  <pre><code>const int foo;
  if (bar) {
      foo = 1;
  } else {
      foo = 2;
  }
  </code></pre>
  
  <p>In Java, this is legal code (using <code>final</code> instead of <code>const</code>). The reason is that in all possible outcomes, the variable is assigned once and never reassigned. In C, this is not legal code. What is the reason that it can't be legal code in C?</p>