¦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

Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  


Write a function to find the depth of a binary tree.

13 Answers   Adobe, Amazon, EFI, Imagination Technologies,


hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?

6 Answers  


what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }

6 Answers   CSC, IIIT,


How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?

0 Answers  


There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.

1 Answers   TCS,


void main() { int const * p=5; printf("%d",++(*p)); }

3 Answers   Infosys, Made Easy, State Bank Of India SBI,


func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }

1 Answers   Satyam,


How do you write a program which produces its own source code as its output?

7 Answers  


main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }

1 Answers  


main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }

3 Answers  


abcdedcba abc cba ab ba a a

2 Answers  


Categories