Hey guys,
why does the following get me an infinite loop?
size_t should be able to take the value of 0, so what seems to be the problem here?Code:for (size_t i = myString.length() - 2; i >= 0; --i) {
cout << "test" << endl;
}
Printable View
Hey guys,
why does the following get me an infinite loop?
size_t should be able to take the value of 0, so what seems to be the problem here?Code:for (size_t i = myString.length() - 2; i >= 0; --i) {
cout << "test" << endl;
}
size_t is unsigned, so >= 0 is always TRUE.
Damn, how stupid was THAT?
Thanks.