title: Memory allocation for array of structure pointers
body: <p>I'm trying to build a memory allocator in C. The user starts by saying how much memory he wants to use, and the smallest block size of memory that can be made available.</p>
  
  <p>So, for example, let's say the user requests 1024B with the smallest block size of 8B.
  That means the possible block sizes would be 1024, 512, 256, 128, 64, 32, 16, and 8.</p>
  
  <p>To keep track of the free blocks of memory, I have an array of pointers to structures. These structures are called Header, and the array is called FreeList.
  What I mean is that FreeList[0] would contain a pointer to the space in memory where there is a block of memory size 8. FreeList[1] would contain a pointer to the space in memory where there is a block of memory size 16. etc.</p>
  
  <pre><code>typedef void * Addr;
  struct Header
  {
      Addr next;
      int order;
  };
  
  struct Header *FreeList[];
  </code></pre>
  
  <p>I'm trying to allocate memory for this free list to use with the following code:</p>
  
  <pre><code>FreeList = malloc(Order*sizeof(struct Header));
  </code></pre>
  
  <p>Where Order is the number of different block sizes you can have.</p>
  
  <p>I'm getting the compile error 'FreeList' has an incomplete type.</p>
  
  <p>I don't want these pointers to point anywhere yet, I just want to allocate the space for the data.</p>