C Program

What is the output of the following code - What is the output of the following code int i=7;printf("%d", i++ * i++);
This question is related to Wipro Interview

Questions by madhu sudhan rao.a

Showing Answers 1 - 33 of 33 Answers

vjsrinath

  • Aug 6th, 2010
 

Yes of-course the compiler reads it from the back.

But the operator here is post increment operator.

So first the compiler will take the value of i , use it and then increment it.
i=7

                                        i++ * i++
                                                    ^
                                                     When compiler comes to this line it will take the value of i before incrementment.

When compile reach another i++ the value of i will be incremented by 1

Hence the answer is 8*7=56

printf works on right to left concept so first i=7 

den it will b increment den i=8
n both multiply n print d result den i will increment
so i=7*8=56

  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