Rotation of Array in C

google
Tags: #<Tag:0x00007f2422c83118>

#1
int* rotateArray(int* A, int n1, int B, int *len) {
int *ret = (int *)malloc(n1 * sizeof(int));
*len = n1;
int i,j,t;
while( B>n1 )
{
    B = B-n1;
}
    for(i=0;i<n1-B;i++){
        int temp = A[n1 - 1];
        for (j = n1 - 1; j > 0; j--) {
             A[j] = A[j - 1];
        }
        A[0] = temp;
    }
    for(i=0;i<n1;i++){
        ret[i]=A[i];
    }
return ret;

}