[Solved] Adding a number to midpoint af an array [closed]


Shift all the items from the midpoint to the right, and then add the midpoint.

If i were you i’d iterate in reverse.

for (int i = array.length - 1; i > midpoint; i--)
{
    array[i] = array[i-1];
}

array[midpoint] = somenumber

solved Adding a number to midpoint af an array [closed]