#include<stdio.h>
main()
{ int i=5;
printf("%d",i*i-- - --i*i*i++ + ++i);

}

tell the answer with correct reason .specially reason is
important nt answer
ans by turbo c is -39



#include<stdio.h> main() { int i=5; printf("%d",i*i-- - --i*i*i++ + ++i); ..

Answer / myname

It it not an easy question.

After investigating it a little bit, I would say:

- It is undefined behaviour, since "i" is being modified more than once between two sequence points.
- I bet that the turbo c answer is not -39, but -34 (5*5 - 4*4*4 + 5) = -34 (not important, anyway, since any other compiler can reorder the operations and give you any other result since, as I have previously said, it is undefined behaviour).

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

in malloc and calloc which one is fast and why?

1 Answers  


What are the loops in c?

0 Answers  


how can i make a program with this kind of output.. Enter a number: 5 0 01 012 0123 01234 012345 01234 0123 012 01 0

4 Answers   Wipro,


what is the height of tree if leaf node is at level 3. please explain

0 Answers  


which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;

0 Answers  






Diff: between this 2 classes in terms of memory class A { int i; char c; double d; }; class A { double d; int i; char c; }; How it is calculating?

1 Answers   HCL,


Do variables need to be initialized?

0 Answers  


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

0 Answers   TCS,


Is null equal to 0 in sql?

0 Answers  


1 1 12 21 123 321 12344231 how i creat it with for loop??

1 Answers  


what will be the output of this program? #include<stdio.h> #define cube(x) x*x*x void main() { int i,j=5; i=cube(j+3); printf("i=%d",i); }

6 Answers   IBM,


Why cant I open a file by its explicit path?

0 Answers  


Categories