Why does this if condition fail for comparison of negative and positive integers [duplicate]
The problem is in your comparison: if ((-1) < SIZE) sizeof typically returns an unsigned long, so SIZE will be unsigned long, whereas -1 is just an int. The rules for promotion in C and related languages mean that -1 will be converted to size_t before the comparison, so -1 will become a very large … Read more