for(j=9; j<0; j--). j<0 is false right away.
Try for(j=9; j>0; j--).
Also array[1][0] = c; doesn't need to be in the loop. Assigning it once after the loop is enough.
Because it has to cycle through the row, there's always going to be one value that gets overwritten before it gets copied. Either used a temp variable to store it and then copy it to its destination at the end, or do the following:
1 2 3 4 5
#include <algorithm>
for (int i = last; i > 1; --i) {
swap(array[0][i], array[0][i-1]);
}
It will iteratively push the last element one step forward until it is the first element. There is no risk over "overwriting", because no value is copied. Instead, values are "moved".
(Behind the scene, values of course ARE copied, but that doesn't really matter. As far as the programmer is concerned, values are moved, not copied.)
@Gaminic:
How should the temp variable be positioned? The one I tried in my opening post does not work I'm afraid. Also, I don't think we're allowed to use swap since it was not taught in class.
Put your "temp restore" (can't pinpoint the line because you didn't use code tags, but I mean the line where you reassign the value of 'c' to an array element) outside of the for loop. It should only copy the value after the rest is done.