#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

create an SINGLE LINKED LISTS and reverse the data in the lists completely

3 Answers  


What is the difference between functions abs() and fabs()?

0 Answers  


Concat two string with most overlapped substring has to removeĀ  "abcd"+ "cdef" = "abcdef

6 Answers  


Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.

0 Answers  


write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1

0 Answers  






#define f(x) main() { printf("\n%d",f(2+2)); }

5 Answers  


What is a const pointer?

0 Answers  


implement OR gate without using any bitwise operator.

1 Answers   Alcatel, Wipro,


Tell me the use of bit field in c language?

0 Answers  


can we initialize all the members of union?

2 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,


Struct(s) { int a; long b; } Union (u) {int a; long b; } Print sizeof(s)and sizeof(u) if sizeof(int)=4 and sizeof(long)=4

2 Answers   Mascot,


Categories