That would cause an infinite loop at best, or undefined behaviour (when an int with value INT_MAX is incremented).
Originally Posted by Salem
If you want to do something over all integers that can be represented on your target system, one technique would be
This is one of those obscure cases that is difficult to achieve without a goto (a break is a goto by another name).
for (i = INT_MIN; ; ++i) /* note no termination condition here */
/* do something with i */
if (i == INT_MAX) break; /* But we break out after finishing with INT_MAX */