Sentinel while loop for C++

Sentinel while loop for C++

A sentinel in this context is a special value used to indicate the end of a sequence. The most common sentinel is at the end of strings. A sentinel while loop would typically have the form:

while (Get(input) != Sentinel) {
  Process(input);
}

A sentinel is a special value, e.g. boolean value, extremely big or small. It is used to determine when to stop the loop.

A good example is in the implementation of merge sort, e.g. read page 4 of http://www.cs.princeton.edu/courses/archive/spr07/cos226/lectures/04MergeQuick.pdf.

Sentinel while loop for C++

As an addendum to JRLs answer..

Please note that there was nothing wrong with asking this question, but in the future you may find more immediate help by going to dictionary.com and looking up words you dont know.

edit: in this case, the dictionary leaves nothing for you to think on. Here is definition 3 đŸ™‚

3 Also called  tag.  Computers. a symbol, mark, or other labeling device indicating the beginning or end of a unit of information.

Leave a Reply

Your email address will not be published.