title: error: ‘void*’ is not a pointer-to-object type what is the right solution?
body: <p>I have the following code:</p>
  
  <pre><code>int partition(void* arr, int start, int end, bool(*cmp_f)(void*, void*),
                void(*swap_f)(void*, void*)) {
  //    Point *pivot = &amp;pts[end];
      int partition_index = start;
  
      for (int i = start; i &lt; end; i++) {
          if (cmp_f(&amp;arr[i], &amp;arr[end])) {// &lt;---------- Here
              swap_f(&amp;arr[i], &amp;arr[partition_index]);// &lt;---------- Here
              partition_index++;
          }
      }
      swap_f(&amp;arr[end], &amp;arr[partition_index]);// &lt;---------- Here
      return partition_index;
  }
  //------------------------------------------------------------------------------
  void quick_sort(Point* pts, int start, int end, bool(*cmp_f)(void*, void*),
                  void(*swap_f)(void*, void*)) {
      if (start &lt; end) {//As long start is less than end we should arrange
          int pivot = partition(pts, start, end, cmp_f, swap_f);
  
          quick_sort(pts, start, pivot - 1, cmp_f, swap_f);
          quick_sort(pts, pivot + 1, end, cmp_f, swap_f);
      }
  }
  //------------------------------------------------------------------------------
  </code></pre>
  
  <p>and I get the following error:</p>
  
  <p>error: ‘void*’ is not a pointer-to-object type</p>
  
  <p>by looking I have found the following answer:</p>
  
  <blockquote>
    <p>As the compiler message says, void* is not a pointer to object type.
    What this means is that you cannot do anything with void*, besides
    explicitly converting it back to another pointer type. A void*
    represents an address, but it doesn’t specify the type of things it
    points to, and at a consequence you cannot operate on it.</p>
  </blockquote>
  
  <p>source:<a href="https://stackoverflow.com/questions/28460449/in-c-im-getting-a-message-error-void-is-not-a-pointer-to-object-type">In C++, I&#39;m getting a message &quot;error: &#39;void*&#39; is not a pointer-to-object type&quot;</a></p>
  
  <p>The error is caused by the following lines:</p>
  
  <pre><code>cmp_f(&amp;arr[i], &amp;arr[end]);
  swap_f(&amp;arr[i], &amp;arr[partition_index]);
  swap_f(&amp;arr[end], &amp;arr[partition_index]);
  </code></pre>
  
  <p>Manual casting wouldn't be helpful for my code Now my question is how i can pass arr[index] to cmp_f or swap_f without manual casting ?</p>