title: With mmap() how can dynamically sized structures be created
body: <p>Hi I have the following scenario</p>
  
  <pre><code>#define CONSTANT 10
  
  struct structA{
      int var1;
      int var2[CONSTANT];
  };
  
  main(){
      structA *varA = NULL;
      int i;
  
      /* some C code */
  
  
      varA = mmap(0,..);
      for(i = 0; i &lt; CONSTANT; i++){
          varA.var2[i] = /* C code */ ;
      }
  
      /* C code */
  
  }
  </code></pre>
  
  <p>Here the number of elements in <code>var2</code> array of <code>structA</code> is constant and hence the <code>varA.var2[i]</code> can be directly referenced . But If the number <code>CONSTANT</code> is to be determined dynamically during runtime , how should the structure definition be modified?</p>