20.09.2018, 19:33
A simple loop.
Assuming an array size of 5, it first moves index 3 to 4, then 2 to 3, then 1 to 2 and last 0 to 1.
After that overwrite index 0 with the new value.
Код:
for(new i = sizeof(array) - 1; i > 0; i --) { array[i] = array[i - 1]; } array[0] = new_value;
After that overwrite index 0 with the new value.