Originally Posted by
Salem
All the integers would be
for ( int i = INT_MIN ; i <= INT_MAX ; i++ )
That would cause an infinite loop at best, or undefined behaviour (when an int with value INT_MAX is incremented).
If you want to do something over all integers that can be represented on your target system, one technique would be
Code:
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 */
}
This is one of those obscure cases that is difficult to achieve without a goto (a break is a goto by another name).