I don't enter the loop using size_t. Why?
If I use int I enter the loop and the output is : 11, 11
int main()
{
int j = 11;
for (size_t i = 11; i > - 1; --j, i -=12)
{
std::cout << i << ", " << j << std::endl;
}
return 0;
}
size_tis typically an unsigned value. In your for loop condition you're sayingi > -1. Sinceiis an unsigned type the -1 is converted to this type, and will have the maximum value for that type.Because of the promotion you're effectivly comparing 11 (the initial value of
i) with the maximum value forsize_tand the result is false, thus the loop is never entered.