0
Help me please to understand code
int x(int &a,int &b){ a=1; b=3; return a*b; } int main() { int a=3; int b=4; int c=(b,b) ; cout<<a<<b<<c;
3 Answers
+ 7
Variable b passed via reference into both parameters of function x.
In function x, original passed value is 4. Altered to 1 on first line, then altered to 3 on second line. Returns 3*3. Hence, local variable c is 9.
The key here is to understand that in function x, a and b refers to the same variable, because both parameters were filled with local variable b, which was passed via reference.
Final output : 339
+ 1
I dont to disapoint you, but output 344, i checked))
+ 1
That's why im asking