Suppose I have an array
unsigned char arr[]= {0,1,2,3,4,5,6,7,8,9};
Is there a way to perform shift operation on them besides just copying them all into another array. We can easily do it using linked lists but I was wondering if we can use a shift operator and get work done faster.
Note: The data in this question is just an example. The answer should be irrecpective of the data in the array.
If you want a circular shift of the elements:
… will do the trick. You’ll need to #include the algorithm header.