+ 2

Can you explain about the output of this code?

https://code.sololearn.com/cMHXJfS72nLx/?ref=app

9th Apr 2018, 7:14 PM
SMH
SMH - avatar
2 Answers
+ 2
"The order of evaluation of arguments is unspecified. All side effects of argument expression evaluations take effect before the function is entered. The order of evaluation of the postfix expression and the argument expression list is unspecified" Source: https://stackoverflow.com/questions/621542/compilers-and-argument-order-of-evaluation-in-c?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
9th Apr 2018, 10:16 PM
Emma
+ 2
first remember that.. the very first priority of all. is. pre operators pre fix operators having 1st priority .. post fix operators has priority less than equal "=". Start from right to left if you come across -->>a++ increment at next statement -->++a increment at same statement for example #include <iostream> using namespace std; void Test(int a,int b ){ cout <<a<<endl<<b<<endl; } int main() { int x{0}; Test(x++,x++); . 1 0 <---- but if you print x i.e 2 remember above re return 0; } #include <iostream> using namespace std; void Test(int a,int b ){ cout <<a<<endl<<b<<endl; } int main() { int x{10}; Test(x++,x++); . // 14. 13-<<--- remember above point of pre fix //output come is 14. and 14.. return 0; } I hope you understand well.. if you not ,sked me again.. we all are happy to ans you
10th Apr 2018, 6:26 AM
Arun Tomar
Arun Tomar - avatar