title: QSorting a malloc'd array of structures?
body: <p>I have this comparator function for my qsort in C, but I seem to be getting a segmentation fault no matter what I try...</p>
  
  <pre><code>int textCompare ( const void * a, const void * b ){
      const char **x =(const char**)a;
      const char **y =(const char**)b;
      return strcmp(*x, *y);
  }
  </code></pre>
  
  <p>Here is my qsort call: where <code>message** mList = malloc(INITIAL_CAPACITY * sizeof(message));</code> and <code>count</code> is an integer keeping track of the last element.  message is just a typedef struct that contains an int and a pointer to a char.  I'm 67% sure that I am calling qsort correctly, can anyone point me in the right direction?</p>
  
  <pre><code>qsort (*mList, count, sizeof(message), textCompare);
  </code></pre>
  
  <p>[EDIT]
  The reason I declare message*** instead of message* is because I'm trying to initialize an "array" of pointers to structures; unless I'm going about this the wrong way?</p>