Int i=5; printf("%d%d%d%d", ++i,i--,--i,i++); while compiling this. It gives 5555 . I can't understand why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Int i=5; printf("%d%d%d%d", ++i,i--,--i,i++); while compiling this. It gives 5555 . I can't understand why?

C programming language.

7th Jun 2019, 7:20 AM
SOHAN SARKAR
SOHAN SARKAR - avatar
2 Answers
0
U r unable to understand the output because u r not aware with the fact that in printf, expressions are solved from right to left bt printed left to right(Hoping u understand pre and post increment and decrement..).. Now, first i++ will get solve then --i, i--, ++i. Hoping u understand pre and post increment and decrement..
11th Jun 2019, 9:07 AM
Neelabh Dubey
0
Thanks
11th Jun 2019, 10:43 AM
SOHAN SARKAR
SOHAN SARKAR - avatar