using namespace std;
Int & amp; Fun1 ()
{int a;
return a;
}
Int & amp; Fun2 (int a)
{
Return a + 1;
}
Int main () {
Fun1 ()=5;
Cout
Fun2 (b) +=2;
Cout
}
Ask these two functions respectively what problems?
CodePudding user response:
Error is returned to a local variable references, and retrieves a reference to a temporary variableCodePudding user response:
Fun1 retrieves a reference to a local variable, function, a local variable release, reference is unclear; If fun2 function parameters and reference; Int & amp; Fun2 (int & amp; a)