¦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
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 |
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 |
void main() { char ch; for(ch=0;ch<=127;ch++) printf(ā%c %d \nā, ch, ch); }
main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }
How to read a directory in a C program?
print numbers till we want without using loops or condition statements like specifically(for,do while, while swiches, if etc)!
Finding a number which was log of base 2
Is the following code legal? struct a { int x; struct a b; }
Is the following code legal? struct a { int x; struct a *b; }
main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }
code of a program in c language that ask a number and print its decremented and incremented number.. sample output: input number : 3 321123
main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }
What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;
main() { int c=- -2; printf("c=%d",c); }