how would you iterate over every possible value of a unsigned int?
unsigned char x = 0;
do {
printf("%d\n", x);
} while (++x); unsigned int x = 0;
const unsigned int max = ~x;
while (x <= max) {
calc(x++);
}
Or, #include <limits.h>
const unsigned int max = UINT_MAX; unsigned int x = 0;
while (x < ~x) {
calc(x++);
}
Or going down: unsigned int x = ~0;
while (x > ~x) {
calc(x--);
} while (1) {
calc(x++);
}
which is an infinite loop, since the expression x <= max is always true