I have been looking for a way of sorting subset of arrays in C without moving the elements to a temporary array, and copying them back. I might have a bad understanding about qsort, but I think the below code should work:

```
qsort(&my_struct_arr[1],3,sizeof(my_struct),my_struct_cmp);
//my_struct_arr is a 4 element array, where i want to sort from position 1 to 3
int my_struct_cmp(const void *a, const void *b)
{
    my_struct A=*(my_struct*)a, B=*(my_struct*)b;
    if(A.x-B.x < 0.01) return A.y-B.y;
    return A.x-B.x;
}
typedef struct foo
{
    float x, y;
} my_struct;

```

Problem is, it does not work. 

**Update 1:**
Okay, I see I wasn't entirely clear about the problem. I initalized the array from position 1 to 3, so I have an array with elements like this: 

{ { ValueFromPreviousIteration.x,ValueFromPreviousIteration.y }, {x1,y1}, {x2,y2}, {x3,y3} }

My problem is, that qsort called like above will sort the entire array, whereas I only want to sort the last 3 elements of it.