If you always want to sort by x, then you can hard-code it into the sort function, and just pass a pointer to the array to sort:

void quicksort(point * arr, int left, int right) {
    // test points with 
    // if (arr[i].x &lt; arr[j].x) {/* i sorts before j */}
}

quicksort(arr, 0, n-1);


To specify a class member to sort by, you need a pointer-to-member, not a pointer; something like:

void quicksort(point * arr, int point::*member, int left, int right){
    // test points with 
    // if (arr[i].*member &lt; arr[j].*member) {/* i sorts before j */}
}

quicksort(arr, &amp;point::x, 0, n-1);


More generically, you could follow the example of std::sort and accept any comparison functor:

template &lt;typename RandIter, typename Compare&gt;
void quicksort(RandIter begin, RandIter end, Compare compare) {
    // test points with 
    // if (compare(*it1, *it2)) {/* *it1 sorts before *it2 */}
}

quicksort(arr, arr+n, 
    [](point const &amp;lhs, point const &amp;rhs) {return lhs.x &lt; rhs.x;});


And of course, unless you're learning how to implement a sorting algorithm, just use std::sort.

How to pass an array of members of a struct as a parameter to a function?
Business can sometimes mean company or firm. However, can it be used in the way company or firm are used?

For example, can I say:-


  
  "He is the CEO of the business."
  "It's a TV business."
  "A business dealing with drugs."
  

