title: Sort char pointer array in C
body: <p>I am trying to sort array of char pointers, for that purpose I use <code>qsort</code> function, but I can't understand what I am doing wrong and how I can sort that array. </p>
  
  <pre><code>int StringCompare( const void* a, const void* b)
  {
      char const *char_a = (char const *)a;
      char const *char_b = (char const *)b;
  
      return strcmp(char_a, char_b);
  }
  
  int main() {
      char *a[] = { "Garima",
            "Amit",
            "Gaurav",
            "Vaibhav"
          };
  
      int n;
  
      qsort( a, 4, sizeof(char*), StringCompare);
      for (n=0; n&lt;4; n++)
          printf ("%c ",*a[n]);
  }
  </code></pre>
  
  <p><strong>The Output is</strong>: G A G V </p>