How can an integer x be inserted into position pos in a given array, with all the original elements after pos shifted forward? Assume that there is enough free space in the array to insert the new element.