+ 2
Will it result right or not?
When we take 2 integer types of variables, it reserved memory of 2 bytes both and then we declare third variable of int type to store the addition of first both and if the sum both is high then 2 bytes then what will happen?
4 Respostas
+ 3
It sounds like you are describing integer overflow.
In the event that an integer variable assigned a value that exceeds its range, the new value will switch over to the opposite extreme.
For example, the integer range is between -2147483648 and 2147483647.
If an integer variable is assigned a value equal to max value + 1, the assigned value will be the min value.
Here is some code I just wrote to demonstrate this:
https://code.sololearn.com/cocB0xRzq6MW/#cpp
Here is a good article explaining this concept further.
http://nethack.wikia.com/wiki/Integer_overflow
+ 3
You are most welcome. If you believe that was the answer, you can click the check mark next to the answer to mark it for others to see.
0
thanks
0
thanks