title: How to create a variable size char array in VC++
body: <pre><code>const int sizea = 600; 
  char sz[sizea];
  </code></pre>
  
  <p>above code works fine. But below code segment cause errors.
  I'm working on visual studio 2005 - MFC application</p>
  
  <pre><code>CString strFinal;
  
  .......//strFinal value is dynamically changing . . 
  
  const int size = strFinal.GetLength();
  char sz[size];
  </code></pre>
  
  <blockquote>
    <p>Error 2   error C2057: expected constant expression<br>
    Error 5   error C2070: 'char []': illegal sizeof operand<br>
    Error 4   error C2133: 'sz' : unknown size     Error  3   error C2466: cannot allocate an array of
    constant size 0</p>
  </blockquote>