Suppose z is an integer while z and y are long variables. If you write z = z + y; in your C program, which of the following will happen?
Suppose z is an integer while z and y are long variables. If you write z = z + y; in your C program, which of the following will happen?
Explanation
In z = z + y;, since z is an int and y is long, y is converted to int (if possible) to match the type of z due to usual type conversion rules.
The result is calculated as an int, and this may cause data loss if y exceeds int range.