title: C programming Circular list for memory suballocator
body: <p>Am trying to build a memory suballocator. I've some errors with the code bellow, it tells me that:</p>
  
  <pre><code>free_list_ptr-&gt;next = &amp;firstByte;
  free_list_ptr-&gt;prev = &amp;firstByte;
  </code></pre>
  
  <p>am getting gcc error warnings of <code>warning: assignment from incompatible pointer type</code></p>
  
  <pre><code>//primitive variable of byte as char, always positive.
  typedef unsigned char byte;
  static byte *memory = NULL;
  
  struct header;
  
  typedef struct _header {
      int signiture;
      int size;
      struct header* next;
      struct header* prev;
  } header;
  
  
  static header *free_list_ptr;
  
  
  void allocator_init(u_int32_t size){
  
      memory = (byte*) malloc(size);
  
      //initialize free_list_ptr;
      free_list_ptr = (header*) memory;
  
          header* firstByte = (header*) memory;
  
      free_list_ptr-&gt;size = size;
  
      //error here: warning: assignment from incompatible pointer type
      free_list_ptr-&gt;prev = &amp;firstByte;
      free_list_ptr-&gt;next = &amp;firstByte;
  }
  </code></pre>