main() { i=10; printf("%d",++i++); printf("%d",++i); } A. 11 and 13 B. 12 and 13 C. error D. Both A and B

This question is related to Wipro Interview

Showing Answers 1 - 14 of 14 Answers

Sathyan

  • Nov 16th, 2006
 

The ans is: 7


B'coz i=6 is an assignment statement and it returns TRUE

so i=7 will be executed atlast then 7 is retuned


 

  Was this answer useful?  Yes

amar

  • Apr 12th, 2007
 

Here, you have given us wrong answer.
For this I got 11 and 12 when I do some modification in given question, otherwise Option is d.

  Was this answer useful?  Yes

anjani

  • Apr 30th, 2007
 

error

because Lvalue is required

  Was this answer useful?  Yes

We are given with the above code basically gives us an error as-
Lvalue required as:
i=10;
++i++
means okay, let's take ++i=11, thus value of i is 11 now, you have i=11, but the post increment operator means 11++ which is wrong as you cannot increment a constant only variables can be here incremented, thus lvalue is required, shows error.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions