Here is my problem: I have a struct:
struct point { int x; int y; }; and then I have an array:
for (int i = 0;i < n;i++) { arr[i].x=rand() % n + 1; } I defined the quicksort function as follows:
void quicksort(int *a, int left, int right); and I want to sort the point by X coordinate, so I call the quicksort:
quicksort(arr.x, 0, n-1); And this is the error message:
error: request for member 'x' in 'arr', which is of non-class type 'point [(((unsigned int)(((int)n) + -0x000000001)) + 1)]'
Sorry if the question is too stupid or badly formulated, the truth is I'm a newbie and I'm really willing to learn as much as possible and I'd be very thankful for your help!
rand.std::sort, and define a custom comparator.y