Original Post
Hi, I had a question about how a for-loop should be set up. In C++ Primer, the author seems to use != instead of < in all the for-loops, but my question is, why? What if you set up a for loop as such: for (int i = 0; i != 11; i += 2) then you've got a problem, because i will never equal 11. I know that specific example is very easy to see the problem, but if you had something a little bit more complex, I assume it would be fairly hard to find the problem to fix it. Therefore, my question is: Why do you suppose != is used in C++ Primer, instead of <? I am thinking I might be missing something important that will change my theory, but it makes logical sense that < should be used instead. Thanks, dbproguy