previous | start

Overflow?

This program compiles and runs with no errors reported even though the 10 result is clearly wrong mathematically.

This just emphasizes the fact that arithmetic for these integer data types does not obey the same rules as ordinary integer arithmetic.

How does a programmer write code to check whether overflow may occur for these data types?

More on this later!



previous | start