Arrays: Left Rotation

  • + 3 comments

    There is no need to do copying of data. The question is just to print out the values. The following code suffices, I think.

    int *b;
    int b_i;
    
    b = a + k;
    for(b_i = 0; b_i < n; b_i++)
    {
        if((int)(b - a) >= n)
        {
            b = a;
        }
        printf("%d ",*b++);
    }