just started an introductory C++
course. I have a query as below.
The data type for a sentinel value is always a boolean
? True or false?
From wiki
Below are some examples of common sentinel values and their uses:
- Null character for indicating the end of a null-terminated string
- Null pointer for indicating the end of a linked list
- A negative integer for indicating the end of a sequence of non-negative integers
- End-of-file, a non-character value returned by certain input routines to signal that no further characters are available from a file
- High Values, a key value of hexadecimal 0xFF used in business programming
So it all depends how you define "sentinel"
Let's look at an example of a sentinel value found in the Standard:
But what type is this character sequence (and the value zero that ends it)?