Hi All, another easy one for you guys...
I'm trying to figure out why I'm receiving the same results after executing both functions in the following program. Shouldn't the bolded line produce a result of 15?
Thanks for any help...
_________________
int tripCBV(int);
int tripCBR(int &);
int main()
{
int count = 5;
cout << "BEFORE - CBV result is " << count << endl;
cout << "AFTER - CBV result is " << tripCBV(count) << endl;
cout << "AFTER function result is " << count << endl << endl;
cout << "BEFORE - CBR result is " << count << endl;
cout << "AFTER - CBR result is " << tripCBR(count) << endl;
cout << "AFTER function result is " << count << endl << endl;
return 0;
}
int tripCBV(int x)
{
int y;
y = 3 * x;
return y;
}
int tripCBR(int &x)
{
int y;
y = 3 * x;
return y;
}
cout << "AFTER function result is " << count << endl << endl;