yihangho yihangho - 1 year ago 115
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.

Answer Source

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) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download