You can use either, and in C, I think
< is more
common. In C++, the STL adds a new twist:
for(FooType::iterator i = foo.begin(); i != foo.end(); i++)
... do stuff ...
!=, because in some (most?) cases
< will not even be defined for the iterator type.
So you might want to use
!= in non-STL loops too, just
Note: I normally use
as other answers say, it means you can't miss the sentry value. But
this is no big deal; if you are unexpectedly missing the
sentry, then you already have a bug.