const int size = 16; int i; float list[size]; ... if (i < 0 || i >= size) { cout << "Error: Index out of range"; } else { list[i] += 1.0f; }
if ((unsigned int)i < (unsigned int)size) { list[i] += 1.0f; } else { cout << "Error: Index out of range"; }
const int min = 100, max = 110; ... if (i >= min && i <= max) { ...
if ((unsigned int)(i - min) <= (unsigned int)(max - min)) { ...