for (size_t i = 0; i < length; i++) {
size_t j = (length - 1) - i;
...
}
EDIT: change i to j for (size_t i = 0; i < length; i++) {
size_t j = (length - 1) - i;
...
}
EDIT: change i to jMakes my brain hurt, but I think this will only run through the loop one time looking at the last element of the array.
const j = (length - 1) - i;
in that case. Much safer.