Or alternatively:
size_t i = length;
while (i--) ... size_t i = length;
while (i--) ... for (size_t i = length; i-- > 0 ; ) ...
that several other people posted would not execute for index 0. Shouldn't it be this instead? for (size_t i = length; --i > 0 ; ) ...