• + 0 comments

    Yes. But I think it will slower than

    int *swp = new int[n];
    memcpy(swp, (const void *)(arr + d), (n - d) * sizeof(int));
    memcpy(swp + (n - d), (const void *)arr, d * sizeof(int));
    

    Correct me if I am wrong.