Quote Originally Posted by mike1
I'm sorry could you explain this a bit more?
Here is what the C standard says about fscanf, which also applies to scanf:
Quote Originally Posted by C11 Clause 7.21.6.2 Paragraph 16
The fscanf function returns the value of the macro EOF if an input failure occurs before the first conversion (if any) has completed. Otherwise, the function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure.
As such, we can take advantage of this to do some input error checking, e.g.,
Code:
if (scanf(" %d", &lookUpVal) == 1) {
    // ...
}
else {
    // Handle the input error
    // ...
}