main()
{
int i = 10;
printf(" %d %d %d \n", ++i, i++, ++i);
}

Answers were Sorted based on User's Feedback



main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }..

Answer / nitin

13 11 13

Is This Answer Correct ?    71 Yes 27 No

main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }..

Answer / san

13,11,11

Is This Answer Correct ?    106 Yes 63 No

main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }..

Answer / dhivya

11 11 13
++i which means i is first incremented and then printed thus i value becomes 11,
i++ which means i is printed and then it is incremented, since the value of i is now 11, it is printed and then incremented to 12.
again ++i , increments i to 13 and then prints.

Is This Answer Correct ?    66 Yes 38 No

main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }..

Answer / dr. sanyasi naidu pasala

13 11 11
First the value of i was assigned to right most variable ++i. In this first i value which is 10 will be incremented to 11, then assigned to i and printed as 11. Then that 11 is passed to the middle variable which is i++. In this first the value 11 is assigned to i, print the value of i as 11 and then incremented to 12. This 12 is now passed to left most variable ++i. In this the value 12 is first incremented to 13 then assigned to i and print as 13. Even though generally the evaluation will be taken place from right most variable to left most variable, the evaluation process may vary from operating system to operating system.

Is This Answer Correct ?    27 Yes 11 No

main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }..

Answer / krityangan

The Answer is 13 11 13
because the post increment will printed first and then pre.
i=10
the ++i=11,i++=12,++i=13,but in c the compiler will print ++p which is now 13 and after that when the compiler come to i++ it will print 11 because in the pre addition the previous vale is printed first andthan i= 12.

Is This Answer Correct ?    27 Yes 11 No

main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }..

Answer / rajjak khan

131113

Is This Answer Correct ?    4 Yes 1 No

main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }..

Answer / pooja alagarsamy

when compiled as a program, it gives this output:

13 11 13

Is This Answer Correct ?    3 Yes 0 No

main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }..

Answer / sanjay kumar

Undefined behaviour

Is This Answer Correct ?    7 Yes 21 No

main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }..

Answer / thaslima

11,10,11

Is This Answer Correct ?    6 Yes 33 No

main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }..

Answer / senthil

13 12 13

Is This Answer Correct ?    2 Yes 29 No

Post New Answer

More C Interview Questions

Explain high-order and low-order bytes.

0 Answers  


What are identifiers and keywords in c?

0 Answers  


How can you increase the allowable number of simultaneously open files?

0 Answers  


number 2 plssssss help !!....using array.. turbo c.. create a program that will accept a number and determine if it is a happy number or an unhappy number.. example: enter a number : 7 7*7=49 then 4 and 9 4*4 and 9*9== 16 + 18 gives you 97 then 9 and 7 9*9 and 7*7 == 81 + 49 gives you 130 then 1 and 3 1*1 and 3*3 == 1 + 9 gives you 10 1*1 gives you 1 sample output: 7= 49= 16+81= 97= 81+49=130 =1+9=10 =1 "7 is a happy number" . if the last number is 2 then the number being inputed is not a happy number.

3 Answers  


Why is malloc used?

1 Answers  






dibakar & vekatesh..uttejana here..abt ur reply for in place reversal of linked list..wats p stands for there?

1 Answers  


How would you print out the data in a binary tree, level by level, starting at the top?

6 Answers   Amazon, Microsoft,


What header files do I need in order to define the standard library functions I use?

0 Answers  


Did c have any year 2000 problems?

0 Answers  


What does %d do in c?

0 Answers  


Write a Program to accept different goods with the number, price and date of purchase and display them

0 Answers   HDFC,


Will Macros support multiple arguments ?

7 Answers   Oracle,


Categories