Sentinel Values

“Halt!  Who goes there?”  The sentinel on duty at the castle was wide awake.  Our sentinel values don’t carry weapons or defend ramparts, but they perform useful guarding tasks in our programs.  In computer science, a sentinel value is a value that would not normally occur in input and serves as a marker of the end of input.  Occasionally they can also be in a location in an array, not at the end of the data, but representing when a condition has been met.  Two examples are discussed below.

Continue reading “Sentinel Values”