title: Problem with initializing variable-sized array?
body: <p>I cannot seem to compile my code when initializing a variable-sized array (code below). The thing is the code below is a sample code from university lecture notes, so it should work perfectly fine but it doesn't.</p>
  
  <pre><code>int MAX = 20;
  char input[MAX] = {'\0'};
  </code></pre>
  
  <p>I saw a question with similar title and the person stated that he can only compile when he use constant variable as the size of array. So I tried writing the code below but i still get the same  compile error.</p>
  
  <pre><code>const int MAX = 20;
  int main() {
      char input[MAX] = {'\0'};
  </code></pre>
  
  <p>What's more confusing is that when i try to hard-code the size of the array (code below) it works. I don't understand why and what is the problem with the codes above when to me it looks the same with the code below.</p>
  
  <pre><code>char input[20] = {'\0'};
  </code></pre>
  
  <p>Is it a problem with the compiler? Or is this syntax not really allowed in C?</p>