title: error: expected declaration specifiers or ‘...’ before ‘lessthen_predictable_t?
body: <p>Following this tutorial:
  <a href="http://www.jamesmolloy.co.uk/tutorial_html/7.-The%20Heap.html" rel="nofollow">http://www.jamesmolloy.co.uk/tutorial_html/7.-The%20Heap.html</a></p>
  
  <p>I have the following errors:</p>
  
  <pre><code>source/ordered_array.c: In function ‘insert_ordered_array’:
  source/ordered_array.c:43:67: error: expected identifier before ‘[’ token
  source/ordered_array.c:43:67: error: too few arguments to function ‘array-&gt;less_than’
  make: *** [obj/ordered_array.o] Error 1
  </code></pre>
  
  <p>From my compiler. I don't get any of it as I have followed the tutorial fully.</p>
  
  <p>here are the files associated:</p>
  
  <p>ordered_array.h:</p>
  
  <pre><code>// ordered_array.h -- Interface for creating, inserting and deleting
  //                    from ordered arrays.
  //                    Written for JamesM's kernel development tutorials.
  
  #ifndef ORDERED_ARRAY_H
  #define ORDERED_ARRAY_H
  
  #include "common.h"
  
  /**
     This array is insertion sorted - it always remains in a sorted state (between calls).
     It can store anything that can be cast to a void* -- so a u32int, or any pointer.
  **/
  typedef void* type_t;
  /**
      A predicate should return nonzero if the first argument is less than the second.  Else 
      it should return zero.
  **/
  typedef s8int (*lessthan_predicate_t)(type_t,type_t);
  typedef struct
  {
      type_t *array;
      u32int size;
      u32int max_size;
      lessthan_predicate_t less_than;
  } ordered_array_t;
  
  /**
     A standard less than predicate.
  **/
  s8int standard_lessthan_predicate(type_t a, type_t b);
  
  /**
     Create an ordered array.
  **/
  ordered_array_t create_ordered_array(u32int max_size, lessthan_predicate_t less_than);
  ordered_array_t place_ordered_array(void *addr, u32int max_size, lessthan_predicate_t  less_than);
  
  /**
     Destroy an ordered array.
  **/
  void destroy_ordered_array(ordered_array_t *array);
  
  /**
     Add an item into the array.
  **/
  void insert_ordered_array(type_t item, ordered_array_t *array);
  
  /**
     Lookup the item at index i.
  **/
  type_t lookup_ordered_array(u32int i, ordered_array_t *array);
  
  /**
     Deletes the item at location i from the array.
  **/
  void remove_ordered_array(u32int i, ordered_array_t *array);
  
  #endif // ORDERED_ARRAY_H
  </code></pre>
  
  <p>ordered_arrays.c:</p>
  
  <pre><code>// ordered_array.c -- Implementation for creating, inserting and deleting
  //                    from ordered arrays.
  //                    Written for JamesM's kernel development tutorials.
  
  #include "ordered_array.h"
  
  s8int standard_lessthan_predicate ( type_t a, type_t b )
  {
  return ( a &lt; b ) ? 1:0;
  }
  
  ordered_array_t create_ordered_array ( u32int max_size, lessthan_predicate_t less_than     )
  {
  ordered_array_t to_ret;
  to_ret.array = ( void* ) kmalloc ( max_size * sizeof ( type_t ) ) ;
  memset ( to_ret.array, 0, max_size*sizeof ( type_t ) );
  to_ret.size = 0;
  to_ret.max_size = max_size;
  to_ret.less_than = less_than;
  return to_ret;
  }
  
  ordered_array_t place_ordered_array ( void *addr, u32int max_size, lessthan_predicate_t   less_than )
  {
  ordered_array_t to_ret;
  to_ret.array = ( type_t *) addr;
  memset ( to_ret.array, 0, max_size*sizeof ( type_t ) );
  to_ret.size = 0;
  to_ret.max_size = max_size;
  to_ret.less_than = less_than;
  return to_ret;
  }
  
  void destroy_ordered_array ( ordered_array_t *array )
  {
  // kfree ( array -&gt; array );
  }
  
  void insert_ordered_array ( type_t item, ordered_array_t *array )
  {
  ASSERT ( array -&gt; less_than );
  u32int iterator = 0;
  ---------------------------------------Faulting Line------------------------------------
  while ( iterator &lt; array -&gt; size &amp;&amp; array -&gt; less_than ( array -&gt;[iterator], item )    )
  ----------------------------------------------------------------------------------------
  
      iterator++;
  if ( iterator == array -&gt; size ) // just add at the end of the array.
      array -&gt; array [array -&gt; size++] = item;
  else
  {
      type_t tmp = array -&gt; array[iterator];
      array -&gt; array[iterator] = item;
      while ( iterator &lt; array -&gt; size )
      {
          iterator++;
          type_t tmp2 = array -&gt; array[iterator];
          array -&gt; array[iterator] = tmp;
          tmp = tmp2;
      }
      array -&gt; size++;
  }
  }
  
  type_t lookup_order_array ( u32int i, ordered_array_t *array )
  {
  ASSERT ( i &lt; array -&gt; size );
  return array -&gt; array [i];
  }
  
  void remove_ordered_array ( u32int i, ordered_array_t *array )
  {
  while ( i &lt; array -&gt; size )
  {
      array -&gt; array[i] = array -&gt; array[i+1];
      i++;
  }
  array -&gt; size--;
  }
  </code></pre>
  
  <p>Any idea's why I'm getting the compile errors?</p>