Yes, it is quite disappointing that such problem would pass unnoticed.
squeekeek wrote:Oddly, it included an error to "scanf" too.
Actually it was not an error message, but a warning. The compiler was quite pedantic and notified you that the function scanf returns a value that should be used somehow in an expression. You don't have to do that, of course!
The function scanf (and others, like sscanf) returns the number of values correctly parsed from the input, or EOF (a macro constant) if the end-of-file was reached before reading. I find it useful to check this returned value so that I can ensure the input follows the specified description. I do this using the assert macro from <assert.h>, which aborts the program (and causes a Runtime Error) if the statement is false: