+ 1
What is the output of this code ??????
int x(int &a, int &b){ a=3; b=4; return a+b; } int main () { int a=2; int b=7; int c=x(a,a); cout<<a<<b<<c; }
5 Antworten
+ 3
sanket charanpahadi plz check it in code playground on your own... if you get doubt in results, feel free to ask
+ 2
Ketan Lalcheta thanks
+ 1
sanket charanpahadi I don't think it has error.. it should output 478
+ 1
sanket charanpahadi
try changing function call as int c = x(a,b) and output will be 347...
with these two output, try to understand the logic behind it... concept of function call pass by reference is used in this.
feel free to ask if you are still confused
0
Ketan Lalcheta This code gives an error