¦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 to count the number the same (letter/character foreg: 's') in a given sentence.

2 Answers  


print numbers till we want without using loops or condition statements like specifically(for,do while, while swiches, if etc)!

11 Answers   Wipro,


void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(ā€œ%dā€,k); }

1 Answers  


main() { clrscr(); } clrscr();

2 Answers  


Write a routine to implement the polymarker function

0 Answers   TCS,






const int perplexed = 2; #define perplexed 3 main() { #ifdef perplexed #undef perplexed #define perplexed 4 #endif printf("%d",perplexed); } a. 0 b. 2 c. 4 d. none of the above

1 Answers   emc2, HCL,


Print an integer using only putchar. Try doing it without using extra storage.

2 Answers  


How we print the table of 3 using for loop in c programing?

7 Answers  


struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }

1 Answers  


struct Foo { char *pName; char *pAddress; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); obj->pName = malloc(100); obj->pAddress = malloc(100); strcpy(obj->pName,"Your Name"); strcpy(obj->pAddress, "Your Address"); free(obj); printf("%s", obj->pName); printf("%s", obj->pAddress); } a. Your Name, Your Address b. Your Address, Your Address c. Your Name Your Name d. None of the above

2 Answers   HCL,


main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }

2 Answers  


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,


Categories