// This demonstrates the behaviour of unsigned ints // that wrap around when we go beyond their limits // So adding 1 to the largest unsigned int, gives us 0 // Subtracting 1 from 0 gives us the largest unsigned int #include #include int main(void){ unsigned int x = UINT_MAX; printf("%u + 1 = %u\n", x, x + 1); unsigned int y = -1; printf("-1 = %u\n", y); // infinite loop. Uncomment to try it out // z can never be < 0 as it is an unsigned type! // for(unsigned int z = 3; z >= 0; z--){ // printf("%u\n",z); // } return 0; }