Removes an element from the dynamic array at the specified index.
index The index of the element to be removed.