¦void main()
¦{
¦int i=10,j;
¦ j=i+++i+++i;
¦printf("%d",j);
¦getch();
¦}
¦ output:-30
but in same question if we write as-
¦void main()
¦{
¦int i=10;
¦ int j=i+++i+++i;
¦printf("%d",j);
¦getch();
¦}
¦ output:-33
why output is changed from 30 to 33. Can any body answer...

Answers were Sorted based on User's Feedback



¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d&..

Answer / ram

no change same answer for both as 30.

Is This Answer Correct ?    0 Yes 0 No

¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d&..

Answer / manikandan

ithink cannot use void in main().becoz returns integer. and output of this 2 program is 30 only.not print 33

Is This Answer Correct ?    2 Yes 3 No

¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d&..

Answer / abhishek kumar

this question is itself is confusing question as if we
compile it with c,c++ compiler, the compiler itself get
confuse and it take i=10 all time as it does not make
distinguish between operator in expression(i+++i+++i) and
give output as 30, but if we compile it with java compiler
it output is 33, as java compiler make distinguish between
operator as (i++ +i+ ++i).

so my conclusion is that question given above is confusing
itself that why output are varying every time.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C Code Interview Questions

Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30

1 Answers   GoDB,


What is the output for the program given below typedef enum errorType{warning, error, exception,}error; main() { error g1; g1=1; printf("%d",g1); }

1 Answers  


main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }

6 Answers  


main() { extern out; printf("%d", out); } int out=100;

1 Answers  


plz send me all data structure related programs

2 Answers  






Finding a number multiplication of 8 with out using arithmetic operator

8 Answers   Eyeball, NetApp,


program to Reverse a linked list

12 Answers   Aricent, Microsoft, Ness Technologies,


#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

2 Answers  


Write a program to model an exploding firecracker in the xy plane using a particle system

0 Answers   HCL,


int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().

2 Answers  


what is the code of the output of print the 10 fibonacci number series

2 Answers  


/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }

4 Answers  


Categories