Exactly! That's precisely the problem with it.
(Hint: think about your code when size = 0.)
for (size_t i = size; i—- > x;)