What will the value of the result variable be after the code segment below has been run.
int result ;
int number4 = 6,number11 = 9;
result = number4 + ++number11;
Output
16
Explanation
result = number4 + ++number11
The value of number4 is 6 and the value of number11 is 9.
There is pre increment on number11, therefore its value will be increased to 10 before evaluating the expression.
6 +10=16
Hence the result is 16.
Comments
Leave a comment