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 ?    58 Yes 28 No

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

Answer / nitin

13 11 13

Is This Answer Correct ?    35 Yes 14 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 ?    37 Yes 24 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 ?    11 Yes 4 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 ?    8 Yes 4 No

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

Answer / sanjay kumar

Undefined behaviour

Is This Answer Correct ?    3 Yes 16 No

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

Answer / senthil

13 12 13

Is This Answer Correct ?    2 Yes 20 No

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

Answer / thaslima

11,10,11

Is This Answer Correct ?    5 Yes 24 No

Post New Answer



More C Interview Questions

pascal triangle program

2 Answers  


consider the following program sigment int n,sum=1; switch(n) { case 2:sum=sum+2; case 3:sum*=2; break; default:sum=0;} if n=2, what is the value of sum a.0 b.6 c.3 d.none

7 Answers   TCS,


write program on arrays

3 Answers   GE, Polycab,


how does the C compiler interpret the following two statements p=p+x; q=q+y; a. p=p+x; q=q+y b. p=p+xq=q+y c. p=p+xq; q=q+y d. p=p+x/q=q+y

2 Answers   TCS, Tech Synergy,


write a program to display the numbers in the following format 4 4 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 4

9 Answers   NIIT, IBM, Winit,






diff. between *p and **p

3 Answers  


5. What kind of sorting is this: SORT (k,n) 1.[Loop on I Index] repeat thru step2 for i=1,2,........n-1 2.[For each pass,get small value] min=i; repeat for j=i+1 to N do { if K[j]<k[min] min=j; } temp=K[i];K[i]=K[min];K[min]=temp; 3.[Sorted Values will be returned] A)Bubble Sort B)Quick Sort C)Selection Sort D)Merge Sort

2 Answers   Accenture,


What is difference between the following 2 lines…. int temp = (int)(0x00); int temp = (0x00int);

3 Answers   Bosch,


what is the syallabus of computer science students in group- 1?

0 Answers  


can v write main() { main(); } Is it true?

6 Answers  


a 'c' program to tell that the set of three coordinates lie on a same line

3 Answers   Persistent,


how to find out the biggest element (or any other operation) in an array which is dynamic. User need not to mention the array size while executing.

3 Answers  






Categories