xxx of yyy characters
Join Group
Google Translation: Off

When Google Translation is on, topics and messages in this group will be machine-translated to your language by Google.

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

Posted by Ar Míng ™ 

Note: To add an image or link in your message, use <img src="http://www.hi5.com/example.jpg"> or <a href="http://www.hi5.com/example.html">Text </a>

 
 

  
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


Note: To add an image or link in your message, use <img src="http://www.hi5.com/example.jpg"> or <a href="http://www.hi5.com/example.html">Text </a>

 
 

  

Title
body