yihangho yihangho - 3 months ago 58
C++ Question

Sentinel while loop for C++

Can anyone tell me what is sentinel while loop in C++? Please give me an example using sentinel while loop.


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

while (Get(input) != Sentinel) {