title: array size and const
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4589463/initialize-array-size-from-another-array-value">initialize array size from another array value</a>  </p>
  </blockquote>
  
  
  
  <p><strong>in C++</strong></p>
  
  <pre><code>const int a[]={1,2,3,4,5}; 
  int b[a[2]]; 
  
  int main()
  {
      return 0;
  } 
  </code></pre>
  
  <p>The code is giving error in line 2; 
  However, if it is something like below it gives no error after compilation: </p>
  
  <pre><code>const int a=3; 
  int b[a]; 
  
  int main()
  {
      return 0;
  } 
  </code></pre>
  
  <p>Why is that? however if i define array b inside main it is alright in both the cases...</p>