Is there a way in C or C++ to check whether the number provided by the user is outside the range of an integer type?
For instance, let us assume that we are using 16-bit signed integers with a range of -32768 to 32767.
If the user enters 55555 into the program, this will be wrapped to become a negative number so that if you are using a function which can accept any number, the result would be wrong.
Is there a way in C or C++ to determine whether the number provided by the user is within the range of the integer type?
Update: I am using the numbers in a simple subtraction program which accepts two numbers and subtracts the second from the first.