0

Why a=3, but b =3;

int x(int &a,int &b){ a=1; b=3; return a*b; } int main() { int a=3; int b=4; int c=x(b,b) ; cout<<a<<b<<c;

4th Aug 2017, 7:31 PM
Vladyslav Sabadakh
Vladyslav Sabadakh - avatar
2 Respostas
+ 1
I am pretty sure that the actual answer should be 133? a and b are sent as reference so the function should be able to modify the values
6th Aug 2017, 8:55 AM
Luca
Luca - avatar
0
not ur not(( not 133
6th Aug 2017, 12:33 PM
Vladyslav Sabadakh
Vladyslav Sabadakh - avatar