int x=5; printf("%d %d %d", x++,x,x); What is the output?in c++ and java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

int x=5; printf("%d %d %d", x++,x,x); What is the output?in c++ and java

why they are different

24th Jun 2018, 11:11 AM
Sid Bro
1 Answer
+ 5
The result is varied because of the architecture of Compiler. ● Some compilers starts executing from left to right & some from right to left. Tip : It is recommended to write these types of codes in a separate line. ------------------------------------------- * For deeper understanding you can search on google "Undefined behaviour in C/C++".
24th Jun 2018, 12:14 PM
Rahul Sahani
Rahul Sahani - avatar