20. main()
{
int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
}
Answer:??????

Answers were Sorted based on User's Feedback



20. main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); } Answer:??????..

Answer / ashok kumar

45545

Is This Answer Correct ?    5 Yes 0 No

20. main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); } Answer:??????..

Answer / ashish

The only concept here is that the printf starts 'generating'
results from RHS to LHS.
Hence, in the process of generation: i=5; then --i=4; ++i=5;
i--=5(due to the postfix concept, but after finishing this
calculation i=4); now i++=4(after performing i++, the value
of 'i' is 5, but for printing, due to the postfix concept,
i=4, the current value of 'i' will be printed).

The printing happens in order from LHS to RHS. Hence these
values are printed as 4 5 5 4 5.

Is This Answer Correct ?    5 Yes 1 No

Post New Answer

More C Interview Questions

Why the below program throughs error during compilation? #include<stdio.h> #include<conio.h> enum { ZERO, ONE, TWO, }; main() { printf("%d",&TWO); getch(); }

2 Answers  


What is binary tree in c?

0 Answers  


Is multithreading possible in c?

0 Answers  


What is the difference between procedural and functional programming?

0 Answers  


Explain About fork()?

0 Answers   TISL,






Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

0 Answers  


Is return a keyword in c?

0 Answers  


Explain how can I pad a string to a known length?

0 Answers  


#include<std.h> int main() { char *str[]={"Frogs","Do","Not","Die","They","Croak!"}; printf("%d %d\n",sizeof(str),strlen(str)); ...return 0; } what will the output of the above program?

6 Answers  


coding for Fibonacci.?

1 Answers  


How can I recover the file name given an open stream or file descriptor?

0 Answers  


How many bytes are occupied by near, far and huge pointers (dos)?

0 Answers  


Categories