Loop starting at -1 doesn’t print anything [duplicate]
sizeof returns an unsigned integer, so TOTAL_ELEMENTS is also unsigned. d is signed. Initially, d is -1. However, when doing the comparison, d is implicitly typecast to unsigned, so it is no longer -1 when being compared to TOTAL_ELEMENTS, it is actually UINT_MAX (which is 4294967295 on my machine, but might differ for others). Also, … Read more