4 ms·
> but what good is that if the program isn't prepared to deal with the sudden jump to a large value Aaaand you only need to care about this case. For an unsig
by raverbashing 11y ago
> but what good is that if the program isn't prepared to deal with the sudden jump to a large value
Aaaand you only need to care about this case.
For an unsigned int just check: x < (your max value)
For signed ints: x < (your max value) AND x > 0
Oh, the downward counting loop example. Because that's done very frequently no? I really don't remember when was the last time I did that (I'd much rather have an upwards loop then y = MAX_VALUE - x (adding 1 if needed)
Quite funnily, if you do a loop in x86 assembly, it is naturally downwards counting, if ECX is zero the loop ends
Don't use a for, just i = (n - 1); do { i--;} while (i);