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

main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }

4 Answers  


What do you mean by a local block?

0 Answers   InterGraph,


all c language question

0 Answers   Wipro,


What are the 4 data types?

0 Answers  


can anyone proide me reading material on svit00ef27@yahoo.com please thanx in advance

1 Answers   IBM,






read the folllowing code # define MAX 100 # define MIN 100 .... .... if(x>MAX) x=1; else if(x<MIN) x=-1; x=50; if the initial value of x=200,what is the vlaue after executing this code? a.200 b.1 c.-1 d.50

4 Answers   TCS,


Explain the priority queues?

0 Answers  


What is the Purpose of 'extern' keyword in a function declaration?

0 Answers  


what is the maximum limit of row and column of a matrix in c programming. in linux .

4 Answers   NIIT,


How to add two numbers with using function?

2 Answers   Miracle Solutions,


How can I convert integers to binary or hexadecimal?

2 Answers  


How can I make a program in c to print 'Hello' without using semicolon in the code?

9 Answers   C DAC, Practical Viva Questions,


Categories