Best way to shift an array in C?
Solution 1:
There is a faster option:
A circular buffer where insert, remove and read are all O(1).
Solution 2:
They both have the same time complexity. Any other difference in performance would be due to specific circumstances, such as the CPU, the compiler, how memmove is implemented, and the size of the array, so you have to actually measure the performance each way and see what is best.
Solution 3:
I don't think that an array is the best way to do this , try using a linked list and you wont have this problem.