title: Void pointers in C++
body: <p>I have written this qsort:</p>
  
  <pre><code>void qsort(void *a[],int low,int high, int (*compare)(void*,void*));
  </code></pre>
  
  <p>When I call this on</p>
  
  <pre><code>char *strarr[5];
  </code></pre>
  
  <p>It says invalid conversion from char** to void**. Why this is wrong?</p>
  
  <p>This is the code:</p>
  
  <pre><code>#include&lt;cstdlib&gt;
  #include&lt;cstdio&gt;
  #include&lt;iostream&gt;
  
  using namespace std;
  
  inline void strswap(void *a,void *b) {
      char *t=*(char**)a;
      *(char**)a=*(char**)b;
      *(char**)b=t;
  }
  
  int strcompare(void *a, void *b) {
      return strcmp(*(char**)a,*(char**)b);
  }
  
  void qsort1(void *a[],int low,int high, int (*compare)(void*,void*), void (*swap)(void*,void*)) {
      if(low&gt;=high)
          return;
      int q=low-1;
      for(int i=low;i&lt;=high-1;i++)
          if((*compare)(&amp;a[i],&amp;a[high]) &lt; 0)
              swap(&amp;a[i],&amp;a[++q]);
      swap(&amp;a[high],&amp;a[++q]);
      qsort1(a,low,q-1,compare,swap);
      qsort1(a,q+1,high,compare,swap);
  }
  
  int main() {
      const  int n=3;
      //int a[n]={4,6,8,12,10,9,8,0,24,3};
      char *strarr[5]={"abcd","zvb","cax"};
      qsort1(strarr,0,n-1,strcompare,strswap);
      for(int i=0;i&lt;n;i++)
          cout &lt;&lt; strarr[i] &lt;&lt; " ";
      cout &lt;&lt; endl;
      return 0;
  }
  </code></pre>