What is a sentinel value and how is it used?
What will be an ideal response?
A sentinel value is a value that should never be encountered in the input of the program. It
is used to control looping mechanisms when the number of repetitions is unknown. When the
sentinel value is encountered, the loop terminates. A sentinel value is commonly used with while
and do….while statements.
Computer Science & Information Technology