Use memmove instead of a for loop to shift array elements to left or right