#include <simplecpp>
int &f(int &x, int &y) {
if (x > y) return x;
else return y;
}
main_program{
int p=5, q=4;
f(p,q) = 2;
cout << p << ' ' << q << endl;
cout << f(p, q) << endl;
}
(It’s a little simple version of C++ used to teach students). What I am not able to understand is the & before the function declaration. What exactly is it doing?
New contributor
KeShAw is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.