non testato ma dovrebbe funzionare
codice:
int*sort(int a[], int n, int x){
    int b[n],i;
    for(i=0;i<n;i++,x++) b[i]=a[x%n];
    return b;
}