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 / san

13,11,11

Is This Answer Correct ?    106 Yes 61 No

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

Answer / nitin

13 11 13

Is This Answer Correct ?    69 Yes 26 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

I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

0 Answers  


How reliable are floating-point comparisons?

0 Answers  


being a chemical engineer and with an aggregate of 80% why you opt for TCS and not your core industry?

1 Answers   TCS,


how to find the largest element of array without using relational operater?

6 Answers   Satyam, Wipro,


plssssss help !!....using array.. turbo c.. create a program that will accept number of words to be consored. .a word must not exceed 10 characters long .the text to be entered will be no longer than 200 characters .there will be no 10 words example: enter number of words to be censor: 5 enter words to censor: windows office microsoft bill gates enter text to censor: bill gates founded microsoft and makes office and windows sample output: <consored> <censored> founded <censored> and makes <censored> and <censored>

1 Answers  






Reverse the part of the number which is present from position i to j. Print the new number.[without using the array] eg: num=789876 i=2 j=5 778986

2 Answers  


Are pointers integers in c?

0 Answers  


What are the __date__ and __time__ preprocessor commands?

0 Answers  


what type of questions arrive in interview over c programming?

0 Answers  


What Is The Difference Between Null And Void Pointer?

0 Answers   TCS,


How can you increase the size of a dynamically allocated array?

0 Answers   TISL,


True or false: If you continuously increment a variable, it will become negative? 1) True 2) False 3) It depends on the variable type

7 Answers  


Categories