Messages
Topic:
Please help me sir !!!
// main function
int& result = square(4);
// sub function
int& square(int a) {
int temp = a;
temp *= temp;
return temp;
}
//why that it warn about to return the
//reference with the local variable sir ???
May 12
3:46 AM
Why are you calling the function before you are declaring it?
Perhaps this is the problem. Move the line
int& result = square(4);
to the end of subfunction declaration.
Jul 14
12:50 PM