Predict the output of the following code. 

Justify. 

int k = 5; 

b = 0; 

b = k++ + ++k; 

cout<

Share with your friends
Call

Output is 12. In this statement first it take the value of k in 5 then increment it K++. So first operand for + is 5. Then it becomes 6. Then ++k makes it 7. This is the second operand. Hence the result is 12.

Talk Doctor Online in Bissoy App