First of all merry xmas guys....
i have this c++ code but i cannot understand why this output is coming plese help......
MY OUTPUTS ARECode:#include<iostream>
using namespace std;
int func(int&x,int y=10)
{
if(x%y==0)
return ++x;
else
return y--;
}
int main()
{
int p=20,q=23;
q=func(p,q);
cout<<p<<" "<<q<<"\n"; //here the value of q would have become 22 but its still 23 why...
p=func(q);
cout<<p<<" "<<q<<"\n";
q=func(p);
cout<<p<<" "<<q<<"\n";
return 0;
}
20 23
10 23
11 11