Code:
for(INITIALIZATION EXPRESSION; LOOP CONDITION; INCREMENT EXPRESSION)
The loop you've posted looks like this (the other statements don't actually do anything):
As you can see, the only active part of the for loop is the loop condition. In C, any negative integer value evaluates to boolean false, so the loop will terminate when ++i becomes negative. That happens when i wraps around, i.e. it goes something likes this depending on how large it is:
Code:
1, ..., SHORT_MAX, SHORT_MIN, SHORT_MIN + 1, ...