Void main (){ int x = 10; printf ("x = %d, y = %d", x,--x++);}

A) none of the above
B) 10, 11
C) 10, 9
D) 10, 10
Explanation: L value required

Showing Answers 1 - 4 of 4 Answers

Ramya

  • Mar 15th, 2006
 

The ans is 10,9.

the precedence order for increment operators if from right to left..so first x value is decremented..it becomes 9 (here y value becomes 9)and further incremented by 1 which makes the x equal to 10.

Regards,

Ramya Katamneni

  Was this answer useful?  Yes

Sohal

  • Mar 19th, 2006
 

First value printed is the simple one.

For the second value,item to be printed corresponds to --x++ which yields 9++. Remember that, Post/Pre -Inc/Dec operation applies only to variable and not to constants.

  Was this answer useful?  Yes

supriya.ahire

  • Mar 21st, 2006
 

  Ans: Lvalue required..

      it will print first value .but in second value it will perform preincrement operater which will result as a int value but we can't postincrement that value,we can postincrement variable.so it requires a variable  to store that value so it gives Lvalue required error.

navin

  • Jul 29th, 2006
 

Lvalue required
program will not run

  Was this answer useful?  Yes

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